Soumyakanti Das created HIVE-28917:
--------------------------------------
Summary: NPE in merge statement when checking nullability of
joining column in matched clause
Key: HIVE-28917
URL: https://issues.apache.org/jira/browse/HIVE-28917
Project: Hive
Issue Type: Improvement
Components: Hive
Affects Versions: 4.0.1
Reporter: Soumyakanti Das
To reproduce, create a qtest file with:
{noformat}
create table target(a int, b int) stored by iceberg
tblproperties('format-version'='2', 'write.merge.mode'='copy-on-write');
create table source(a int, b int) stored by iceberg
tblproperties('format-version'='2', 'write.merge.mode'='copy-on-write');
merge into target as t using source as s on t.a = s.a
when matched and t.a is null then delete;{noformat}
and run:
{noformat}
mvn test -pl itests/qtest-iceberg -Piceberg -Pitests
-Dtest=TestIcebergCliDriver -Dtest.output.overwrite=true
-Dqfile=<test-file.q>{noformat}
Error:
{noformat}
java.lang.NullPointerException
at
org.apache.hadoop.hive.ql.Context.getMergeDestClausePrefix(Context.java:365)
at org.apache.hadoop.hive.ql.Context.getDestNamePrefix(Context.java:345)
at
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.doPhase1(SemanticAnalyzer.java:1831)
at
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.doPhase1(SemanticAnalyzer.java:2128)
at
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.doPhase1(SemanticAnalyzer.java:2128)
at
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.doPhase1(SemanticAnalyzer.java:1763)
at
org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:643)
at
org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:13180)
at
org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:479)
at
org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyzeInternal(RewriteSemanticAnalyzer.java:71)
at
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:336)
at
org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyzeRewrittenTree(RewriteSemanticAnalyzer.java:108)
at
org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.rewriteAndAnalyze(RewriteSemanticAnalyzer.java:99)
at
org.apache.hadoop.hive.ql.parse.MergeSemanticAnalyzer.analyze(MergeSemanticAnalyzer.java:207)
at
org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyze(RewriteSemanticAnalyzer.java:85)
at
org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyzeInternal(RewriteSemanticAnalyzer.java:73)
at
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:336){noformat}
Since we are checking if the joining column is null in the matched clause,
which is not possible as it is a joining column, we should throw an exception
and exit gracefully instead of throwing an NPE
--
This message was sent by Atlassian Jira
(v8.20.10#820010)