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

NullPointerException on invalid table name in ON clause of Merge statement

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
    • Critical
    • Resolution: Fixed
    • None
    • 2.2.0
    • Transactions
    • None

    Description

      Ran into this error message - "Error while compiling statement: FAILED: NullPointerException null " when I specified an incorrect tablename in the merge statement.

      > create table src (col1 int,col2 int);
      No rows affected (0.231 seconds)
      > create table trgt (tcol1 int,tcol2 int);
      No rows affected (0.182 seconds)
      > insert into src values (1,232);
      
      > merge into trgt using (select * from src) sub on sub.col1 = *invalidtablename.tcol1* when not matched then insert values (sub.col1,sub.col2);
      Error: Error while compiling statement: FAILED: NullPointerException null (state=42000,code=40000)
      
      > merge into trgt using (select * from src) sub on sub.col1 = *trgt.tcol1* when not matched then insert values (sub.col1,sub.col2);
      
      INFO  : Session is already open
      INFO  : Dag name: merge into trgt using ...(sub.col1,sub.col2)(Stage-1)
      INFO  : Setting tez.task.scale.memory.reserve-fraction to 0.30000001192092896
      INFO  : 
      
      INFO  : Status: Running (Executing on YARN cluster with App id application_1485398058799_0129)
      
      INFO  : Map 1: 0/1	Map 2: -/-	
      INFO  : Map 1: 0(+1)/1	Map 2: -/-	
      INFO  : Map 1: 0(+1)/1	Map 2: -/-	
      INFO  : Map 1: 1/1	Map 2: -/-	
      INFO  : Loading data to table tpch.trgt from hdfs://tesths2-merge-ks-5.openstacklocal:8020/apps/hive/warehouse/tpch.db/trgt/.hive-staging_hive_2017-01-30_06-54-50_743_6276941178188398287-1/-ext-10000
      INFO  : Table tpch.trgt stats: [numFiles=1, numRows=1, totalSize=4, rawDataSize=3]
      No rows affected (7.709 seconds)
      

      Hiveserver2 logs:

      2017-01-30 19:34:09,972 INFO  [HiveServer2-Handler-Pool: Thread-70]: parse.ParseDriver (ParseDriver.java:parse(185)) - Parsing command: merge into trgt using (select * from src) sub on sub.col1 = target.tcol1 when not matched then insert values (sub.col1,sub.col2)
      2017-01-30 19:34:09,975 INFO  [HiveServer2-Handler-Pool: Thread-70]: parse.ParseDriver (ParseDriver.java:parse(209)) - Parse Completed
      2017-01-30 19:34:09,976 INFO  [HiveServer2-Handler-Pool: Thread-70]: log.PerfLogger (PerfLogger.java:PerfLogEnd(177)) - </PERFLOG method=parse start=1485804849971 end=1485804849976 duration=5 from=org.apache.hadoop.hive.ql.Driver>
      2017-01-30 19:34:09,976 INFO  [HiveServer2-Handler-Pool: Thread-70]: log.PerfLogger (PerfLogger.java:PerfLogBegin(149)) - <PERFLOG method=semanticAnalyze from=org.apache.hadoop.hive.ql.Driver>
      2017-01-30 19:34:09,977 INFO  [HiveServer2-Handler-Pool: Thread-70]: metastore.HiveMetaStore (HiveMetaStore.java:logInfo(824)) - 13: get_table : db=tpch tbl=trgt
      2017-01-30 19:34:09,977 INFO  [HiveServer2-Handler-Pool: Thread-70]: HiveMetaStore.audit (HiveMetaStore.java:logAuditEvent(393)) - ugi=hive     ip=unknown-ip-addr      cmd=get_table : db=tpch tbl=trgt
      2017-01-30 19:34:10,031 ERROR [HiveServer2-Handler-Pool: Thread-70]: ql.Driver (SessionState.java:printError(980)) - FAILED: NullPointerException null
      java.lang.NullPointerException
              at org.apache.hadoop.hive.ql.parse.UpdateDeleteSemanticAnalyzer$OnClauseAnalyzer.getPredicate(UpdateDeleteSemanticAnalyzer.java:1143)
              at org.apache.hadoop.hive.ql.parse.UpdateDeleteSemanticAnalyzer$OnClauseAnalyzer.access$400(UpdateDeleteSemanticAnalyzer.java:1049)
              at org.apache.hadoop.hive.ql.parse.UpdateDeleteSemanticAnalyzer.handleInsert(UpdateDeleteSemanticAnalyzer.java:1025)
              at org.apache.hadoop.hive.ql.parse.UpdateDeleteSemanticAnalyzer.analyzeMerge(UpdateDeleteSemanticAnalyzer.java:660)
              at org.apache.hadoop.hive.ql.parse.UpdateDeleteSemanticAnalyzer.analyzeInternal(UpdateDeleteSemanticAnalyzer.java:80)
              at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:230)
              at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:465)
              at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:321)
              at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1221)
              at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:1215)
              at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:146)
              at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:226)
              at org.apache.hive.service.cli.operation.Operation.run(Operation.java:276)
              at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:468)
              at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:456)
              at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:298)
              at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:506)
              at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1317)
              at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1302)
              at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
              at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
              at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
              at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      

      Attachments

        1. HIVE-15755.02.patch
          3 kB
          Eugene Koifman
        2. HIVE-15755.01.patch
          3 kB
          Eugene Koifman

        Activity

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

          People

            ekoifman Eugene Koifman Assign to me
            kavansuresh@gmail.com Kavan Suresh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment