Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-16317

CASE .. NULL in JOIN condition can trigger SemanticException

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • Query Planning
    • None

    Description

      hive> explain select a.key from src a join src b on case when a.key=b.key then 1 else null end;
      FAILED: SemanticException tok_null encountered with 0 children
      
      "2489e686-bf69-4f37-b733-72491351644b main"
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondPopulateAlias(SemanticAnalyzer.java:2629)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondition(SemanticAnalyzer.java:2904)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.parseJoinCondition(SemanticAnalyzer.java:2808)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genJoinTree(SemanticAnalyzer.java:8916)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10506)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10419)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:408)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:11119)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:286)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:258)
      	at org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:165)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:258)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:511)
      	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1316)
      	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1456)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1236)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1226)
      	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:233)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:184)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
      	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821)
      	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759)
      	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      

      In HIVE-15708 this causes query31 to fail CBO optimization.

      Attachments

        1. HIVE-16317.01.patch
          45 kB
          Remus Rusanu

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rusanu Remus Rusanu Assign to me
            rusanu Remus Rusanu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment