-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[CALCITE-7397] Error in simplifying join condition when creating LEFT MARK JOIN #4770
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
Conversation
| !plan | ||
| !} | ||
|
|
||
| # [CALCITE-7397] TopDownGeneralDecorrelator can cause nullable property mismatches |
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 noticed from the error message that after the subquery was removed the condition of left mark join was FALSE, I think this is the root cause. When the IN subquery is converted to a left mark join, its join condition originally looks like CAST(NULL AS int) = $x. However, inside builder.join the join condition is simplified using an “UNKNOWN AS FALSE” policy. But for a mark join, the marker is a three-valued-logic boolean, so strictly speaking the join condition should be simplified to NULL::BOOLEAN, so maybe we should use “UNKNOWN AS UNKNOWN ” policy for lelf mark join.
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.
Thank you for pointing out the root cause, which is more correct than my logic for calling convert later. I tried modifying it according to your suggestion, and I'll see if it meets your requirements.
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.
Quidem cannot be executed at the moment, so I used a different method and added a test in RelOptRulesTest, which also verified the problem.
205e604 to
a0e5873
Compare
|
The code looks great. I have a small suggestion for the title. How about changing it to "Error in simplifying join condition when creating left mark join"? This better reflects the root cause. |
a0e5873 to
4ace177
Compare
Done! |
|



See CALCITE-7397
Although the issue in Jira has been resolved, this case still generates a nested loop join (mark join), resulting in a new error, albeit a new one, because we haven't yet implemented nested loop join for left_mark join. However, I'll post this issue and its fix here for now, so we can verify it once nested loop join is implemented.