Skip to content
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

[CALCITE-6680] RexImpTable erroneously declares NullPolicy.NONE for IS_EMPTY #4039

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

mihaibudiu
Copy link
Contributor

Based on a patch submitted in Jira by Chris Dennis
https://issues.apache.org/jira/secure/attachment/13072690/is-empty-nullable.patch

Had to tweak some other parts of Calcite, since the Java type system claimed arrays and maps cannot be null.
I inspected some other array operations as well, hopefully I didn't miss any.

@@ -1019,7 +1019,7 @@ void populate2() {
defineMethod(ARRAY_EXCEPT, BuiltInMethod.ARRAY_EXCEPT.method, NullPolicy.ANY);
defineMethod(ARRAY_JOIN, BuiltInMethod.ARRAY_TO_STRING.method,
NullPolicy.STRICT);
defineMethod(ARRAY_INSERT, BuiltInMethod.ARRAY_INSERT.method, NullPolicy.NONE);
defineMethod(ARRAY_INSERT, BuiltInMethod.ARRAY_INSERT.method, NullPolicy.ARG0);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this ARG0 instead of STRICT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because you can insert a NULL value into an array and the result is not NULL

@mihaibudiu mihaibudiu force-pushed the issue6680 branch 3 times, most recently from 9adf204 to defa56e Compare November 8, 2024 04:28
return lt(b0, b1) ? b0 : b1;
}

public static @Nullable <T extends Comparable<T>> List<T> greater(
Copy link
Member

Choose a reason for hiding this comment

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

Add JavaDoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are at least 10 versions of this function in this file, which share one common comment.

@@ -448,4 +448,177 @@ EXPR$0
[2.111111111111112, 2.1]
!ok

# Tests for CALCITE-6680
Copy link
Member

Choose a reason for hiding this comment

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

Is there any verification in Spark?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is based on the spec of these functions in Calcite. I don't have access to a Spark system.
We should build a proper way to test queries on other systems, not do it manually, this is not sustainable.

Copy link
Member

Choose a reason for hiding this comment

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

Sure

Copy link
Contributor

@NobiGo NobiGo left a comment

Choose a reason for hiding this comment

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

LGTM

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Nov 11, 2024
Copy link

sonarcloud bot commented Nov 11, 2024

@mihaibudiu mihaibudiu merged commit 8b4136b into apache:main Nov 11, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM-will-merge-soon Overall PR looks OK. Only minor things left.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants