-
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
nullable Expr being constant fold to value can cause schema change and internal error #13190
Comments
Good catch. |
Agree, we touched this a little bit with @alamb here #13065 (comment) to have the same solution like it was before DF 42 but its still pending. Probably what we can do is implement WDYT guys? |
Would that mean that constant folding (like this issue) requires the relaxed comparison parameter to be set?
on the code level, i agree that |
We can rewrite Eq to check only what we need just make syntax clean, to preserve |
good point. then let's not support Eq trait and things will be clear. |
Here is existing code to compare only names / types of schemas (not nullabilty / metadata too): |
My current thinking is that we should compare all: names, types, metadata1 and nullability with the only exception being that non-null schema can be used to satisfy nullable requirements. Ie what we need might be asymmetrical "is satisfied by" relation rather than eq / partialEq symmetrical relation. Footnotes
|
You're saying that if the schema changes from nullable to non-null, we should consider this an acceptable change, correct? That makes sense—the idea is that the transformed schema can be more strict, but not more flexible. |
yes, exactly |
Describe the bug
Some Exprs in DataFusion (mostly ScalarFunctions) are defined nullable but when being constant evaluated end up producing a (non-null) value. Since the replacement Expr::Literal is no longer nullable, this can in some cases lead to a schema change and trigger physical/logical schema mismatch check added in #11989
To Reproduce
Running the following query in datafusion cli
Expected behavior
The query should produce a result without errors.
Additional context
No response
The text was updated successfully, but these errors were encountered: