-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 assertion for invariant in create_physical_expression
and fix ViewTable projection
#3242
Add assertion for invariant in create_physical_expression
and fix ViewTable projection
#3242
Conversation
…ical_expression must be the same length
@matthewmturner @DaltonModlin @kmitchener Since this affects views, could you please review if you have time? |
Codecov Report
@@ Coverage Diff @@
## master #3242 +/- ##
=======================================
Coverage 85.84% 85.85%
=======================================
Files 293 293
Lines 53246 53310 +64
=======================================
+ Hits 45710 45770 +60
- Misses 7536 7540 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
LGTM. If you want to reproduce, this triggered the error prior to the fix: create view v as select 1 as a, 2 as b, 3 as c;
select * from (select b from v); -- returned column a prior to fix |
Given the above sql, it results in this plan. Isn't this 1 too many projections?
|
These could easily be optimized out if we could run the optimizer here, but we can't. This also means we lose projection push-down when selecting from a view. This does at least fix the correctness issue, even if this is not efficient so it might be best to file a specific issue for this. I'll take another look at this tomorrow. |
I was wrong about this. We are optimizing. I will add a check to avoid adding a redundant projection. |
I will review it tomorrow, it's too later for me today. @andygrove |
I filed #3248 for removing the redundant projection. The physical plan being returned from
|
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.
Changes look good. Like the idea of using the Arrow schema for determining the expression data types.
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.
LGTM.
Benchmark runs are scheduled for baseline = 82da46d and contender = 92110dd. 92110dd is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
@andygrove sorry i didnt get to this sooner, looks good. |
Which issue does this PR close?
Closes #3240
Rationale for this change
create_physical_expression
accepts an Arrow schema and a DataFusion schema. They should have the same number of fields but there was no check.What changes are included in this PR?
Are there any user-facing changes?
Not sure