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

Merging into iceberg table fails with copy on write when values clause has a function call

    XMLWordPrintableJSON

Details

    Description

      create external table target_ice(a int, b string, c int) stored by iceberg tblproperties ('format-version'='2', 'write.merge.mode'='copy-on-write');
      create table source(a int, b string, c int);
      
      explain
      merge into target_ice as t using source src ON t.a = src.a
      when matched and t.a > 100 THEN DELETE
      when not matched then insert (a, b) values (src.a, concat(src.b, '-merge new 2'));
      
       org.apache.hadoop.hive.ql.parse.SemanticException: Encountered parse error while parsing rewritten merge/update or delete query
      	at org.apache.hadoop.hive.ql.parse.ParseUtils.parseRewrittenQuery(ParseUtils.java:721)
      	at org.apache.hadoop.hive.ql.parse.rewrite.CopyOnWriteMergeRewriter.rewrite(CopyOnWriteMergeRewriter.java:84)
      	at org.apache.hadoop.hive.ql.parse.rewrite.CopyOnWriteMergeRewriter.rewrite(CopyOnWriteMergeRewriter.java:48)
      	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.rewriteAndAnalyze(RewriteSemanticAnalyzer.java:93)
      	at org.apache.hadoop.hive.ql.parse.MergeSemanticAnalyzer.analyze(MergeSemanticAnalyzer.java:201)
      	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyze(RewriteSemanticAnalyzer.java:84)
      	at org.apache.hadoop.hive.ql.parse.RewriteSemanticAnalyzer.analyzeInternal(RewriteSemanticAnalyzer.java:72)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:327)
      	at org.apache.hadoop.hive.ql.parse.ExplainSemanticAnalyzer.analyzeInternal(ExplainSemanticAnalyzer.java:180)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:327)
      	at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:224)
      	at org.apache.hadoop.hive.ql.Compiler.compile(Compiler.java:107)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:519)
      	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:471)
      	at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:436)
      	at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:430)
      	at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:121)
      	at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:229)
      	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:257)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd1(CliDriver.java:201)
      	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:127)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:425)
      	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:356)
      	at org.apache.hadoop.hive.ql.QTestUtil.executeClientInternal(QTestUtil.java:732)
      	at org.apache.hadoop.hive.ql.QTestUtil.executeClient(QTestUtil.java:702)
      	at org.apache.hadoop.hive.cli.control.CoreCliDriver.runTest(CoreCliDriver.java:115)
      	at org.apache.hadoop.hive.cli.control.CliAdapter.runTest(CliAdapter.java:157)
      	at org.apache.hadoop.hive.cli.TestIcebergLlapLocalCliDriver.testCliDriver(TestIcebergLlapLocalCliDriver.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.apache.hadoop.hive.cli.control.CliAdapter$2$1.evaluate(CliAdapter.java:135)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:27)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.apache.hadoop.hive.cli.control.CliAdapter$1$1.evaluate(CliAdapter.java:95)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
      	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
      Caused by: org.apache.hadoop.hive.ql.parse.ParseException: line 18:0 cannot recognize input near 'FROM' 'src' 'WHERE' in function specification
      	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:125)
      	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:97)
      	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:89)
      	at org.apache.hadoop.hive.ql.parse.ParseUtils.parseRewrittenQuery(ParseUtils.java:719)
      	... 66 more
      Caused by: NoViableAltException(160@[290:7: ( ( RPAREN KW_WITHIN )=> ( RPAREN (within= KW_WITHIN KW_GROUP LPAREN ordBy= orderByClause RPAREN ) ) | ( RPAREN (nt= null_treatment )? KW_OVER )=> ( RPAREN ( (nt= null_treatment )? ( KW_OVER ws= window_specification[$nt.tree] ) ) ) | (nt= null_treatment ) RPAREN ( KW_OVER ws= window_specification[$nt.tree] ) | RPAREN )])
      	at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
      	at org.antlr.runtime.DFA.predict(DFA.java:144)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.function(HiveParser_IdentifiersParser.java:4663)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.atomExpression(HiveParser_IdentifiersParser.java:8780)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:8871)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:9068)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseXorExpression(HiveParser_IdentifiersParser.java:9177)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceStarExpression(HiveParser_IdentifiersParser.java:9320)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedencePlusExpression(HiveParser_IdentifiersParser.java:9463)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceConcatenateExpression(HiveParser_IdentifiersParser.java:9602)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAmpersandExpression(HiveParser_IdentifiersParser.java:9812)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseOrExpression(HiveParser_IdentifiersParser.java:9949)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceSimilarExpressionMain(HiveParser_IdentifiersParser.java:10432)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceSimilarExpression(HiveParser_IdentifiersParser.java:10328)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceEqualExpression(HiveParser_IdentifiersParser.java:11784)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:12373)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceNotExpression(HiveParser_IdentifiersParser.java:12563)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAndExpression(HiveParser_IdentifiersParser.java:12672)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceOrExpression(HiveParser_IdentifiersParser.java:12813)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:8569)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.expression(HiveParser.java:43538)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectItem(HiveParser_SelectClauseParser.java:1871)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectList(HiveParser_SelectClauseParser.java:1385)
      	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectClause(HiveParser_SelectClauseParser.java:1155)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.selectClause(HiveParser.java:44066)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.atomSelectStatement(HiveParser.java:37483)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.selectStatement(HiveParser.java:37791)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:37347)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:36646)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:36534)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:2769)
      	at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1648)
      	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:123)
      	... 69 more
      

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              kkasa Krisztian Kasa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: