Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Introduce LogicalPlan invariants, begin automatically checking them #13651
Introduce LogicalPlan invariants, begin automatically checking them #13651
Changes from 3 commits
6d43dc2
a855811
0163a40
bee7e92
4eee9c4
a7d9770
72718ad
2002b1a
fbc9c46
e52187e
ba26f13
ad1a1f8
1164a7b
7ad0b74
911d4b8
810246d
9842d19
00700ae
9bca470
529ac3e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Here is a mention of the extensibility of invariants. Options include:
check_plan()
(or equivalent code)Optimizer.invariants = Vec<Arc<dyn InvariantCheck>>
for user-defined invariantsOptimizerRule::check_invariants()
such that certain invariants are only checked for a given rule (instead of all rules)Ditto for the AnalyzerRule passes. Altho I wasn't sure about how much is added complexity and planning time overhead - as @Omega359 mentions we could make it configurable (e.g. run for CI and debugging in downstream projects).
This WIP is about proposing different ideas of what we could do. 🤔
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.
Maybe it can be controlled through environment variables, similar to
RUST_LOG
orRUST_BACKTRACE
. Enable it for debugging when problems are encountered or during an upgrade.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.
do you have example use-case for user-defined plan invariants?
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.
We have some special invariants for our
SortPreservingMerge
replacement,ProgressiveEval
(related to time ranges of parquet files) that would be great to be able to encodeThere 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.
We could also add it as a
debug_assert!
after each optimizer pass and call the real validationThere 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.
is this about
LogicalPlan::Extension
? I agree it makes sense to support validation of these if we validate the overall plan.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.
I've added this to the followup items list: #13652 (comment)
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.
Is
check_names
also called whenever creating new DFSchema?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.
Yes, on every creation. But not after every merge. Which should be ok if no bug is introduced in the merge -- altho I would prefer to add the check there.