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

Chinna Rao Lalam commented on HIVE-2512:
----------------------------------------

select key, count(1) cnt from src group by key order by count(1) limit 10;

Here order by is requested with the aggregate function in execution flow of 
this query in 
org.apache.hadoop.hive.ql.parse.TypeCheckProcFactory.DefaultExprProcessor.getXpathOrFuncExprNodeDesc(ASTNode,
 boolean, ArrayList<ExprNodeDesc>, TypeCheckCtx) while constructing 
ExprNodeGenericFuncDesc it is expecting GenericUDF() but here it is requested 
with aggregate function so it is returning null and it is throwing 
NullPointerException

So before constructing ExprNodeGenericFuncDesc added a check if it is UDAF 
throw exception

And it should work with below queries ,

select key,min(key) from src group by key having min(key) > 100;
select key,min(key) as mininum from src group by key order by mininum;
                
> After HIVE-2145, Hive disallow any use of function in cluster-by clause
> -----------------------------------------------------------------------
>
>                 Key: HIVE-2512
>                 URL: https://issues.apache.org/jira/browse/HIVE-2512
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Ning Zhang
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-2512.1.patch, HIVE-2512.2.patch, HIVE-2512.patch
>
>
> After HIVE-2145, the following query returns a semantic analysis error: 
> FROM src SELECT * cluster by rand();
> FAILED: Error in semantic analysis: functions are not supported in order by
> Looking back at HIVE-2145, it's clear that the patch is more restrictive than 
> necessary. 
> Chinna, are you able to work on it? Please let me know if you don't have 
> cycles to do it now. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to