-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: CteWorkTable: properly apply TableProvider::scan projection argument #18993
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
base: main
Are you sure you want to change the base?
Conversation
| drop(memory_stream); | ||
| assert_eq!(pool.reserved(), 0); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a test case using projection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! 304d40c
| work_table: Arc<WorkTable>, | ||
| /// Execution metrics | ||
| metrics: ExecutionPlanMetricsSet, | ||
| /// Cache holding plan properties like equivalences, output partitioning etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is outdated now. The field is not named cache anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I have moved back the field name to cache to stay consistent with a lot of other operator implementations: 69464d2
da29338 to
304d40c
Compare
It was previously ignored
Which issue does this PR close?
CteWorkTabledoes not properly apply projection #18992.Rationale for this change
All
TableProviderimplementations must support theprojectionargument of thescanmethod. This was not the case inCteWorkTable.What changes are included in this PR?
Minimal implementation of the projection support. The projection applied before the plan node return results. It might be nice to push it further inside of the recursion implementation to reduce memory consumption but I preferred to keep the fix minimal.
Are these changes tested?
I have not figured out yet a nice SQL query to trigger an error without this change. Some existing queries in
cte.slthave set projection (i.e. notNone) so the code is very likely working. There is also a test on the projection itself inWorkTableExec