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

Group by SemanticException: Invalid column reference

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 1.3.0, 2.1.0
    • None
    • None

    Description

      Some queries work fine in older versions throws SemanticException, the stack trace:

      FAILED: SemanticException [Error 10002]: Line 96:1 Invalid column reference 'key2'
      15/12/21 18:56:44 [main]: ERROR ql.Driver: FAILED: SemanticException [Error 10002]: Line 96:1 Invalid column reference 'key2'
      org.apache.hadoop.hive.ql.parse.SemanticException: Line 96:1 Invalid column reference 'key2'
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genGroupByPlanGroupByOperator1(SemanticAnalyzer.java:4228)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genGroupByPlanMapAggrNoSkew(SemanticAnalyzer.java:5670)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:9007)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9884)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:9777)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:10250)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10261)
      at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:10141)
      at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:222)
      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:421)
      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:305)
      at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1110)
      at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1158)
      at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1047)
      at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1037)
      at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
      at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
      at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
      at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:305)
      at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:403)
      at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:419)
      at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:708)
      at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
      at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      

      Reproduce:

      create table tlb (key int, key1 int, key2 int);
      create table src (key int, value string);
      select key, key1, key2 from (select a.key, 0 as key1 , 0 as key2 from tlb a inner join src b on a.key = b.key) a group by key, key1, key2;
      

      Attachments

        1. HIVE-12784.1.patch
          4 kB
          Yongzhi Chen
        2. HIVE-12784.2.patch
          6 kB
          Yongzhi Chen

        Issue Links

          Activity

            People

              ychena Yongzhi Chen
              ychena Yongzhi Chen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: