[
https://issues.apache.org/jira/browse/HIVE-5607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911040#comment-13911040
]
Xuefu Zhang commented on HIVE-5607:
-----------------------------------
The regression was introduced by HIVE-1367. SQL standard [1] grammar for order
by:
{code}
<order by clause> ::=
ORDER BY <sort specification list>
<sort specification list> ::=
<sort specification> [ { <comma> <sort specification> }... ]
<sort specification> ::=
<sort key> [ <collate clause > ] [ <ordering specification> ]
<sort key> ::=
<column name>
| <unsigned integer>
<ordering specification> ::= ASC | DESC
{code}
>From the standard we can see that , order by clause doesn't not need `(` and
>`)` to enclose the sorted columns. However, hive allows an expression in lieu
>of a column name in the sorted column list, and '(' and ')' are part of
>expression. Thus, parenthesis should be interpreted as an expression construct
>rather than the order_by construct.
The proposal is to remove them from order_by construct.
[1] http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
> Hive fails to parse the "%" (mod) sign after brackets.
> ------------------------------------------------------
>
> Key: HIVE-5607
> URL: https://issues.apache.org/jira/browse/HIVE-5607
> Project: Hive
> Issue Type: Bug
> Components: Query Processor
> Affects Versions: 0.10.0
> Reporter: dima machlin
> Assignee: Xuefu Zhang
> Priority: Minor
>
> the scenario :
> create table t(a int);
> select * from t order by (a)%7;
> will fail with the following exception :
> FAILED: ParseException line 1:28 mismatched input '%' expecting EOF near ')'
> I must mention that this *does* work in 0.7.1 and doesn't work in 0.10
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)