-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix nullAllowed of Domain for identical operator in UtcConstraintExtractor #27213
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
| } | ||
| if (functionName.equals(IDENTICAL_OPERATOR_FUNCTION_NAME)) { | ||
| return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, startOfDate, true, startOfNextDate, false)), true)); | ||
| return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, startOfDate, true, startOfNextDate, false)), false)); |
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.
Would be good to add a jdoc to IDENTICAL_OPERATOR_FUNCTION_NAME documenting semantics (like SQL's NOT DISTINCT FROM, i assume)
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,$identical is equal to IS NOT DISTINCT FROM for SQL.
IDENTICAL(IDENTICAL_OPERATOR_FUNCTION_NAME, "IS NOT DISTINCT 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.
it would be great to document it where io.trino.spi.expression.StandardFunctions#IDENTICAL_OPERATOR_FUNCTION_NAME is defined.
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 have added a jdoc like:
$identical function is equivalent to the SQL operator "IS NOT DISTINCT FROM".
|
Merged, thanks! |
@chenjian2664 @findepi PTAL, I have added a release note. |
|
I don't think it should cause incorrect query results. Please clarify. Also, if this did indeed cause incorrect query results, would you mind adding a regression test that would show that correctness issue in plain sight (if applied before the fix was applied)? |
|
@chenjian2664 i suggest following RN * Fix incorrect results due to incorrect pushdown of `IS [NOT] DISTINCT FROM`. this applies to Iceberg, Delta, PostgreSQL, MySQL |
I think maybe only |
|
Thanks both! |
Description
Since
IDENTICAL_OPERATOR_FUNCTION_NAMEresolves to a range query (>=startOfDate AND <startOfNextDate), which is designed to match a specific date interval, thenullAllowedparameter would be set tofalse.Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(X) Release notes are required, with the following suggested text: