You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Harsh J (JIRA)" <ji...@apache.org> on 2014/10/14 01:44:34 UTC

[jira] [Updated] (HIVE-7178) Table alias cannot be used in GROUPING SETS clause if there are more than one column in it

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

Harsh J updated HIVE-7178:
--------------------------
    Description: 
The following SQL doesn't work: 
{code}
EXPLAIN 
SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
FROM table_name alias 
GROUP BY alias.a, alias.b, alias.c 
GROUPING SETS( (alias.a), (alias.b, alias.a) ); 
FAILED: ParseException line 15:34 missing ) at ',' near '<EOF>' 
line 16:0 extraneous input ')' expecting EOF near '<EOF>' 
{code}

The following SQL works (without alias in grouping set): 
{code}
EXPLAIN 
SELECT a, b, c, COUNT(DISTINCT d) 
FROM table_name 
GROUP BY a, b, c 
GROUPING SETS( (a), (b, a) ); 

Alias works for just one column: 
EXPLAIN 
SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
FROM table_name alias 
GROUP BY alias.a, alias.b, alias.c 
GROUPING SETS( (alias.a) ); 
{code}
Using alias in GROUPING SETS could be very useful if multiple tables are involved in the SELECT (via JOIN)

  was:
The following SQL doesn't work: 
EXPLAIN 
SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
FROM table_name alias 
GROUP BY alias.a, alias.b, alias.c 
GROUPING SETS( (alias.a), (alias.b, alias.a) ); 
FAILED: ParseException line 15:34 missing ) at ',' near '<EOF>' 
line 16:0 extraneous input ')' expecting EOF near '<EOF>' 

The following SQL works (without alias in grouping set): 
EXPLAIN 
SELECT a, b, c, COUNT(DISTINCT d) 
FROM table_name 
GROUP BY a, b, c 
GROUPING SETS( (a), (b, a) ); 

Alias works for just one column: 
EXPLAIN 
SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
FROM table_name alias 
GROUP BY alias.a, alias.b, alias.c 
GROUPING SETS( (alias.a) ); 

Using alias in GROUPING SETS could be very useful if multiple tables are involved in the SELECT (via JOIN)


> Table alias cannot be used in GROUPING SETS clause if there are more than one column in it
> ------------------------------------------------------------------------------------------
>
>                 Key: HIVE-7178
>                 URL: https://issues.apache.org/jira/browse/HIVE-7178
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.13.0
>            Reporter: Yibing Shi
>
> The following SQL doesn't work: 
> {code}
> EXPLAIN 
> SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
> FROM table_name alias 
> GROUP BY alias.a, alias.b, alias.c 
> GROUPING SETS( (alias.a), (alias.b, alias.a) ); 
> FAILED: ParseException line 15:34 missing ) at ',' near '<EOF>' 
> line 16:0 extraneous input ')' expecting EOF near '<EOF>' 
> {code}
> The following SQL works (without alias in grouping set): 
> {code}
> EXPLAIN 
> SELECT a, b, c, COUNT(DISTINCT d) 
> FROM table_name 
> GROUP BY a, b, c 
> GROUPING SETS( (a), (b, a) ); 
> Alias works for just one column: 
> EXPLAIN 
> SELECT alias.a, alias.b, alias.c, COUNT(DISTINCT d) 
> FROM table_name alias 
> GROUP BY alias.a, alias.b, alias.c 
> GROUPING SETS( (alias.a) ); 
> {code}
> Using alias in GROUPING SETS could be very useful if multiple tables are involved in the SELECT (via JOIN)



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