hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From goun na <gou...@gmail.com>
Subject Grouping sets with table alias causes parse exception
Date Mon, 18 Jan 2016 10:28:32 GMT
Hi, Users

While converting legacy Oracle SQL to HiveQL using Grouping set, I found an
interesting parsing error. See the below example, Test-1 shows the expected
result, but Test-2 causes parting exception. Is it known issue?

Test-1> No table alias
select a.col_1, a.col_2
from
(
select '1' as col_1,'1' as  col_2
union all
select '2' as col_1, '2'as  col_2
) a
group by col_1, col_2 grouping sets (col_2, col_1);

----------------
NULL    1
NULL    2
1       NULL
2       NULL


Test-2>Table alias 'a.' is added at group by clause
select a.col_1, a.col_2
from
(
select '1' as col_1,'1' as  col_2
union all
select '2' as col_1, '2'as  col_2
) a
group by a.col_1, a.col_2 grouping sets ((a.col_1, a.col_2), a.col_1);



Error: Error while compiling statement: FAILED: ParseException line 1:162
missing ) at ',' near ')'
line 1:172 missing EOF at ',' near ')'

-- Error caused from HiveServer2



*org.apache.hive.service.cli.HiveSQLException:Error while compiling
statement: FAILED: ParseException line 1:162 missing ) at ',' near ')'
line 1:172 missing EOF at ',' near ')':28:27

Thanks,
Goun Na

Mime
View raw message