Repository navigation
add a checker to confirm optimizer can keep plan schema immutable. - #4233
Conversation
| match result { | ||
| Ok(Some(plan)) => { | ||
| if plan.schema() != new_plan.schema() { | ||
| return Err(DataFusionError::Internal(format!( |
There was a problem hiding this comment.
Could we include the expected and actual schema in the error message? This will make debugging much easier.
There was a problem hiding this comment.
Also, could you add a unit test?
|
Thanks @jackwener. This is a good improvement. Could you fill out the PR description? It helps with the reviews. |
|
Thanks @andygrove review. |
|
This is really nice! |
|
I think we also need to do the same check for physical optimizer. |
andygrove
left a comment
There was a problem hiding this comment.
Very nice. Thanks @jackwener
Sounds like a good idea. Do you want to file an issue for that? |
|
Benchmark runs are scheduled for baseline = 6f62870 and contender = 5ed40e0. 5ed40e0 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Yes, track this via #4299 |
| if plan.schema() != new_plan.schema() { | ||
| return Err(DataFusionError::Internal(format!( |
There was a problem hiding this comment.
@jackwener
Is it possible that the check can not always pass in case that some of the optimization rules might change the nullability of the Schema ?
For example a Column Expression was replaced by a Literal Constant due to Constant propagation ?
select max(t1.id) from (select 123 as id ) as t1 where t1.id = 123;
There was a problem hiding this comment.
Indeed, we may need to relax restrictions on some conditions, such as nullable.
In this way we can get more room for optimization.
But in most cases, we don't need to do this, we can wait until we need to do this
Which issue does this PR close?
Closes #.
In the previous code, we did not verify whether the schema is equal, which may cause some problems.
We can add a checkrt to confirm optimizer can keep plan schema immutable.
Rationale for this change
It's found when I try wo add a new rule.
What changes are included in this PR?
add a checker to confirm optimizer can keep plan schema immutable.
Are these changes tested?
Are there any user-facing changes?