Skip to content

HIVE-27070: Multiple is NULL check together fails in CalcitePlanner#6550

Merged
soumyakanti3578 merged 2 commits into
apache:masterfrom
soumyakanti3578:HIVE-27070
Jun 26, 2026
Merged

HIVE-27070: Multiple is NULL check together fails in CalcitePlanner#6550
soumyakanti3578 merged 2 commits into
apache:masterfrom
soumyakanti3578:HIVE-27070

Conversation

@soumyakanti3578

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Added a new interface NonNullableReturnTypeUDF to identify UDFs with a non-nullable return type.
When a NonNullableReturnTypeUDF is identified in HiveFunctionHelper.getReturnType, we can create the return type with nullability set to false.

Currently GenericUDFOPNull and GenericUDFOPNotNull implements the interface.

Why are the changes needed?

Calcite has a Strong policy where it validates and asserts that the output of a function like IS NULL has a non-nullable return type. This is done in RexSimplify.validateStrongPolicy

Jira: HIVE-27070

Does this PR introduce any user-facing change?

No

How was this patch tested?

mvn test -pl itests/qtest -Pitests -Dtest=TestMiniLlapLocalCliDriver -Dtest.output.overwrite=true -Dqfile="is_null_is_not_null_nested.q"

Comment thread ql/src/java/org/apache/hadoop/hive/ql/udf/generic/NonNullableReturnTypeUDF.java Outdated
Comment thread ql/src/java/org/apache/hadoop/hive/ql/parse/type/HiveFunctionHelper.java Outdated
Comment thread ql/src/test/queries/clientpositive/is_null_is_not_null_nested.q
@sonarqubecloud

Copy link
Copy Markdown

@zabetak zabetak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks for the PR @soumyakanti3578 !

@soumyakanti3578 soumyakanti3578 merged commit 9e38b8a into apache:master Jun 26, 2026
4 checks passed
Asmoday pushed a commit to arenadata/hive that referenced this pull request Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants