Skip to content

Support isDistinctFrom and isNotDistinctFrom operators #3357

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

Merged
merged 21 commits into from
Aug 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,15 @@ private enum BinaryPhysicalOperator {

@Nullable
public Object eval(@Nullable final Object arg1, @Nullable final Object arg2) {
// handle nulls
if (arg1 == null || arg2 == null) {
return null;
if (type == Comparisons.Type.IS_DISTINCT_FROM) {
return arg1 != null || arg2 != null;
} else if (type == Comparisons.Type.NOT_DISTINCT_FROM) {
return arg1 == null && arg2 == null;
} else {
return null;
}
Comment on lines -930 to +1085
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is interesting that we have this early treatment of null values here instead of delegating it to the actual underlying physical operator.

I opened an issue to fix this, as well as introducing NULL type code handling (instead of the deprecated UNKNOWN).
#3526

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I'm not sure about this as well, but putting it in the operators will result in a lot of duplicated code. Fixing it in a separate PR sounds good.

}
return evaluateFunction.apply(arg1, arg2);
}
Expand Down
Loading