[ https://issues.apache.org/jira/browse/HIVE-4108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phabricator updated HIVE-4108: ------------------------------ Attachment: HIVE-4108.D9309.1.patch hbutani requested code review of "HIVE-4108 [jira] Allow over() clause to contain an order by with no partition by". Reviewers: JIRA, ashutoshc allow over clause with only an order spec HIVE-4073 allows over() to be called with no partition by and no order by. We should allow only an order by. >From the review of HIVE-4073: Ashutosh Can you also add following test. This should also work. select p_name, p_retailprice, avg(p_retailprice) over(order by p_name) from part partition by p_name; Harish This test will not work (: The grammar needs to be changed so: partitioningSpec @init { msgs.push("partitioningSpec clause"); } @after { msgs.pop(); } : partitionByClause orderByClause? -> ^(TOK_PARTITIONINGSPEC partitionByClause orderByClause?) | orderByClause -> ^(TOK_PARTITIONINGSPEC orderByClause) | distributeByClause sortByClause? -> ^(TOK_PARTITIONINGSPEC distributeByClause sortByClause?) | sortByClause? -> ^(TOK_PARTITIONINGSPEC sortByClause) | clusterByClause -> ^(TOK_PARTITIONINGSPEC clusterByClause) ; And the SemanticAnalyzer::processPTFPartitionSpec has to handle this shape of the AST Tree. The PTFTranslator also needs changes. Do this as another Jira TEST PLAN added new tests with over clause containing only order spec. REVISION DETAIL https://reviews.facebook.net/D9309 AFFECTED FILES ql/src/java/org/apache/hadoop/hive/ql/parse/FromClauseParser.g ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java ql/src/test/queries/clientpositive/ptf_npath.q ql/src/test/queries/clientpositive/windowing_windowspec.q ql/src/test/results/clientpositive/ptf_npath.q.out ql/src/test/results/clientpositive/windowing_windowspec.q.out MANAGE HERALD RULES https://reviews.facebook.net/herald/view/differential/ WHY DID I GET THIS EMAIL? https://reviews.facebook.net/herald/transcript/22401/ To: JIRA, ashutoshc, hbutani > Allow over() clause to contain an order by with no partition by > --------------------------------------------------------------- > > Key: HIVE-4108 > URL: https://issues.apache.org/jira/browse/HIVE-4108 > Project: Hive > Issue Type: Bug > Components: PTF-Windowing > Reporter: Brock Noland > Assignee: Harish Butani > Attachments: HIVE-4108.D9309.1.patch > > > HIVE-4073 allows over() to be called with no partition by and no order by. We > should allow only an order by. > From the review of HIVE-4073: > Ashutosh > {noformat} > Can you also add following test. This should also work. > select p_name, p_retailprice, > avg(p_retailprice) over(order by p_name) > from part > partition by p_name; > {noformat} > Harish > {noformat} > This test will not work (: > The grammar needs to be changed so: > partitioningSpec > @init { msgs.push("partitioningSpec clause"); } > @after { msgs.pop(); } > : > partitionByClause orderByClause? -> ^(TOK_PARTITIONINGSPEC partitionByClause > orderByClause?) | > orderByClause -> ^(TOK_PARTITIONINGSPEC orderByClause) | > distributeByClause sortByClause? -> ^(TOK_PARTITIONINGSPEC distributeByClause > sortByClause?) | > sortByClause? -> ^(TOK_PARTITIONINGSPEC sortByClause) | > clusterByClause -> ^(TOK_PARTITIONINGSPEC clusterByClause) > ; > And the SemanticAnalyzer::processPTFPartitionSpec has to handle this shape of > the AST Tree. The PTFTranslator also needs changes. Do this as another Jira > {noformat} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira