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

Query with column alias fails in order by

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Query Processor
    • None

    Description

      Query:

      select mtg.marketing_type_group_desc as marketing_type_group
      from marketing_type_group mtg 
      order by mtg.marketing_type_group_desc;
      

      fails with error:

      2017-02-17T11:22:11,441 ERROR [eb89eafb-e100-42b1-8ff1-b3332b2e715f main]: ql.Driver (SessionState.java:printError(1116)) - FAILED: SemanticException [Error 10004]: Line 7:9 Invalid table alias or column reference 'marketing_type_group_desc': (possible column names are: marketing_type_group, prod_type)
      org.apache.hadoop.hive.ql.parse.SemanticException: Line 7:9 Invalid table alias or column reference 'marketing_type_group_desc': (possible column names are: marketing_type_group, prod_type)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genAllExprNodeDesc(SemanticAnalyzer.java:11501)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11449)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11417)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:11395)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genReduceSinkPlan(SemanticAnalyzer.java:7761)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPostGroupByBodyPlan(SemanticAnalyzer.java:9655)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:9554)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10450)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:10328)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genOPTree(SemanticAnalyzer.java:11011)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:478)
      	at org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:11022)
      	at org.apache.hadoop.hive.ql.parse.CalcitePlanner.analyzeInternal(CalcitePlanner.java:285)
      	at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:258)
      	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:514)
      	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1319)
      	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1459)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1239)
      	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1229)
      	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(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.apache.hadoop.util.RunJar.run(RunJar.java:221)
      	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
      

      Attachments

        Issue Links

          Activity

            People

              ctang Chaoyu Tang
              ctang Chaoyu Tang
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: