Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add with clause projection list rewriter #1956

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

andyfengHKU
Copy link
Contributor

// WITH clause is like SQL CTE. So the projection list of WITH clause should be explicitly
// evaluated. This, however, creates problem in the following case
// MATCH (a) WITH a RETURN a.age;
// Although only a.age is needed for further processing. The CTE "MATCH (a) WITH a" require us to
// fully materialize all columns of "a". Note that we cannot rely on projection push down to
// optimize this because projection pushdown assumes all columns in WITH/RETURN are needed.
// Our solution is:
// First rewrite node and rel as their INTERNAL ID property in WITH clause. So
// MATCH (a) WITH a._id RETURN a.age;
// And then apply WithClauseProjectionRewriter after binding to rewrite as
// MATCH (a) WITH a._id, a.age RETURN a.age

@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Patch coverage: 97.29% and project coverage change: -0.01% ⚠️

Comparison is base (9399be0) 89.67% compared to head (fae0134) 89.67%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1956      +/-   ##
==========================================
- Coverage   89.67%   89.67%   -0.01%     
==========================================
  Files         870      873       +3     
  Lines       32019    32070      +51     
==========================================
+ Hits        28714    28759      +45     
- Misses       3305     3311       +6     
Files Changed Coverage Δ
src/binder/bind/bind_projection_clause.cpp 96.00% <92.30%> (-0.78%) ⬇️
...inder/rewriter/with_clause_projection_rewriter.cpp 96.15% <96.15%> (ø)
src/binder/binder.cpp 96.85% <100.00%> (+0.48%) ⬆️
src/binder/bound_statement_rewriter.cpp 100.00% <100.00%> (ø)
...r/query/return_with_clause/bound_projection_body.h 100.00% <100.00%> (ø)
.../binder/rewriter/with_clause_projection_rewriter.h 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andyfengHKU andyfengHKU merged commit 9526e5e into master Aug 25, 2023
10 checks passed
@andyfengHKU andyfengHKU deleted the rewrite-with-clause-projection-list branch August 25, 2023 04:53
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.

None yet

2 participants