hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinna...@huawei.com
Subject Re: Review Request: Hive disallow any use of function in cluster-by clause
Date Tue, 08 Nov 2011 16:03:21 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2479/
-----------------------------------------------------------

(Updated 2011-11-08 16:03:21.111741)


Review request for hive and Ning Zhang.


Changes
-------

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;


Summary
-------

SemanticAnalyzer.genReduceSinkPlan() added a function validation check for orderby and sortby
in the same flow clusterby also executing so it is throwing execption for the clusterby also.

Orderby and Sortby wont support the functions so need to add the function validation check.

Now validation check is modified like it should check only for the orderby and sortby.


This addresses bug HIVE-2512.
    https://issues.apache.org/jira/browse/HIVE-2512


Diffs (updated)
-----

  trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java 1198626 
  trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java 1198626 
  trunk/ql/src/test/queries/clientnegative/orderby_function.q PRE-CREATION 
  trunk/ql/src/test/queries/clientnegative/orderby_function1.q PRE-CREATION 
  trunk/ql/src/test/queries/clientnegative/orderby_function2.q PRE-CREATION 
  trunk/ql/src/test/queries/clientnegative/sortby_function.q PRE-CREATION 
  trunk/ql/src/test/queries/clientpositive/orderby_function.q PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/orderby_function.q.out PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/orderby_function1.q.out PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/orderby_function2.q.out PRE-CREATION 
  trunk/ql/src/test/results/clientnegative/sortby_function.q.out PRE-CREATION 
  trunk/ql/src/test/results/clientpositive/orderby_function.q.out PRE-CREATION 

Diff: https://reviews.apache.org/r/2479/diff


Testing
-------

All unit tests passed


Thanks,

chinna


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message