[ 
https://issues.apache.org/jira/browse/HIVE-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985101#action_12985101
 ] 

Hongwei commented on HIVE-1922:
-------------------------------

I've found where the problem comes from.
The RowResolver class uses table alias and column alias as key to store 
ColumnInfo. 
The RowResolver also has a putExpression method to save expressionsempty-string 
("") as the table alias together with the
string rendering of the ASTNode as the column alias for matching expressions in 
GROUP BY with those in the SELECT list.

The problem is when creating the new RowResolver, the program now only copies 
the column information and the table alias was tossed.
I think adding new RowResolver with the old RowResolver will solve the problem.

> semantic analysis error, when using group by and order by together
> ------------------------------------------------------------------
>
>                 Key: HIVE-1922
>                 URL: https://issues.apache.org/jira/browse/HIVE-1922
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 0.3.0, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.7.0
>         Environment: Ubuntu Karmic, hadoop 0.20.0, hive 0.7.0
>            Reporter: Hongwei
>            Priority: Blocker
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> When I tried queries like, 'select t.c from t  group by t.c sort by t.c;', 
> hive reported error ,'FAILED: Error in semantic analysis: line 1:40 Invalid 
> Table Alias or Column Reference t'.
> But 'select t.c from t  group by t.c ' or 'select t.c from t  sort by t.c;' 
> are ok. 
> 'select t.c from t  group by t.c sort by c;' is ok too.
> The hive server gives stack trace like
> 11/01/20 03:07:34 INFO parse.SemanticAnalyzer: Get metadata for subqueries
> 11/01/20 03:07:34 INFO parse.SemanticAnalyzer: Get metadata for destination 
> tables
> 11/01/20 03:07:34 INFO parse.SemanticAnalyzer: Completed getting MetaData in 
> Semantic Analysis
> FAILED: Error in semantic analysis: line 1:40 Invalid Table Alias or Column 
> Reference t
> 11/01/20 03:07:34 ERROR ql.Driver: FAILED: Error in semantic analysis: line 
> 1:40 Invalid Table Alias or Column Reference t
> org.apache.hadoop.hive.ql.parse.SemanticException: line 1:40 Invalid Table 
> Alias or Column Reference t
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genExprNodeDesc(SemanticAnalyzer.java:6743)
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genReduceSinkPlan(SemanticAnalyzer.java:4288)
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genBodyPlan(SemanticAnalyzer.java:5446)
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.genPlan(SemanticAnalyzer.java:6007)
>       at 
> org.apache.hadoop.hive.ql.parse.SemanticAnalyzer.analyzeInternal(SemanticAnalyzer.java:6583)
>       at 
> org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:238)
>       at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:343)
>       at org.apache.hadoop.hive.ql.Driver.run(Driver.java:731)
>       at 
> org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:116)
>       at 
> org.apache.hadoop.hive.service.ThriftHive$Processor$execute.process(ThriftHive.java:699)
>       at 
> org.apache.hadoop.hive.service.ThriftHive$Processor.process(ThriftHive.java:677)
>       at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:253)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>       at java.lang.Thread.run(Thread.java:662)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to