E52A Refactor rewrite star projection by nafraf · Pull Request #3136 · RedisGraph/RedisGraph · GitHub
[go: up one dir, main page]

Skip to content

Refactor rewrite star projection#3136

Open
nafraf wants to merge 24 commits intomasterfrom
rewrite_star_projection
Open

Refactor rewrite star projection#3136
nafraf wants to merge 24 commits intomasterfrom
rewrite_star_projection

Conversation

@nafraf
Copy link
Contributor
@nafraf nafraf commented Jul 7, 2023

Refactor AST_RewriteStarProjections() and _rewrite_call_subquery_star_projections()

@nafraf nafraf requested a review from raz-mon July 7, 2023 15:45
@codecov
Copy link
codecov bot commented Jul 7, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 🎉

Comparison is base (86d6c12) 90.85% compared to head (6382406) 90.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3136      +/-   ##
==========================================
+ Coverage   90.85%   90.86%   +0.01%     
==========================================
  Files         294      294              
  Lines       30269    30304      +35     
==========================================
+ Hits        27502    27537      +35     
  Misses       2767     2767              
Impacted Files Coverage Δ
src/ast/ast_rewrite_star_projections.c 100.00% <100.00%> (ø)
src/ast/ast_shared.c 99.14% <100.00%> (+0.48%) ⬆️
src/ast/ast_validations.c 97.12% <100.00%> (+0.01%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nafraf nafraf marked this pull request as ready for review July 12, 2023 21:42
Copy link
Collaborator
@raz-mon raz-mon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, see some comments.

@@ -238,7 +217,6 @@ static bool _rewrite_call_subquery_star_projections

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for casting here (can also remove the new-line).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Casting removed

# assert results
self.env.assertEquals(len(res.result_set), 1)
self.env.assertEquals(res.result_set[0], [1, 2])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following case fails:

GRAPH.QUERY g "WITH 1 AS one CALL {RETURN one AS num UNION WITH * WITH * WITH one AS num} RETURN num"

I think the separation between the identifiers and the local_identifiers in _rewrite_call_subquery_star_projections() is probably necessary, but it needs some work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. New tests were added. Now we don't collect identifiers for the RETURN clauses in _rewrite_call_subquery_star_projections(), the identifiers are collected later.

Comment on lines +271 to +275
if(t == CYPHER_AST_WITH) {
collect_with_projections(clause, local_identifiers);
} else {
collect_return_projections(clause, local_identifiers);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We enter these collection functions for a second time if we have a * (first in 252, 254).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Please check the changes done to the function _rewrite_call_subquery_star_projections(), I think now it is simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0