You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Aaron Tokhy (JIRA)" <ji...@apache.org> on 2015/11/20 00:50:11 UTC

[jira] [Updated] (HIVE-12474) ORDER BY should handle column refs in parantheses

     [ https://issues.apache.org/jira/browse/HIVE-12474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Tokhy updated HIVE-12474:
-------------------------------
    Description: 
CREATE TABLE test(a INT, b INT, c INT)
COMMENT 'This is a test table';

hive>
select lead(c) over (order by (a,b)) from test limit 10;
FAILED: ParseException line 1:31 missing ) at ',' near ')'
line 1:34 missing EOF at ')' near ')'

hive>
select lead(c) over (order by a,b) from test limit 10;

- Works as expected.

It appears that 'cluster by'/'sort by'/'distribute by'/'partition by' allows this:
https://github.com/apache/hive/blob/release-1.2.1/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g#L129

For example, this syntax is still valid:
select lead(c) over (sort by (a,b)) from test limit 10;

This is related to changes that were made as a part of HIVE-6617

  was:
CREATE TABLE test(a INT, b INT, c INT)
COMMENT 'This is a test table';

hive>
select lead(c) over (order by (a,b)) from test limit 10;
FAILED: ParseException line 1:31 missing ) at ',' near ')'
line 1:34 missing EOF at ')' near ')'

hive>
select lead(c) over (order by a,b) from test limit 10;

- Works as expected.

It appears that 'cluster by'/'sort by'/'distribute by'/'partition by' allows this:
https://github.com/apache/hive/blob/release-1.2.1/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g#L129

For example, this syntax is still valid:
select lead(c) over (sort by (a,b)) from test limit 10;


> ORDER BY should handle column refs in parantheses
> -------------------------------------------------
>
>                 Key: HIVE-12474
>                 URL: https://issues.apache.org/jira/browse/HIVE-12474
>             Project: Hive
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.0.0, 1.2.1
>            Reporter: Aaron Tokhy
>            Assignee: Pengcheng Xiong
>            Priority: Minor
>
> CREATE TABLE test(a INT, b INT, c INT)
> COMMENT 'This is a test table';
> hive>
> select lead(c) over (order by (a,b)) from test limit 10;
> FAILED: ParseException line 1:31 missing ) at ',' near ')'
> line 1:34 missing EOF at ')' near ')'
> hive>
> select lead(c) over (order by a,b) from test limit 10;
> - Works as expected.
> It appears that 'cluster by'/'sort by'/'distribute by'/'partition by' allows this:
> https://github.com/apache/hive/blob/release-1.2.1/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g#L129
> For example, this syntax is still valid:
> select lead(c) over (sort by (a,b)) from test limit 10;
> This is related to changes that were made as a part of HIVE-6617



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)