HIVE-4108 [jira] Allow over() clause to contain an order by with no partition by
(Harish Butani via Ashutosh Chauhan)

Summary:
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.

Reviewers: JIRA, ashutoshc

Reviewed By: ashutoshc

Differential Revision: https://reviews.facebook.net/D9309

git-svn-id: https://svn.apache.org/repos/asf/hive/branches/ptf-windowing@1455421 13f79535-47bb-0310-9956-ffa450edef68