[
https://issues.apache.org/jira/browse/HIVE-13452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15231208#comment-15231208
]
Ashutosh Chauhan commented on HIVE-13452:
-----------------------------------------
yeah.. difference is MySQL/Postgres treats constant in expressions for group by
as positional reference in select list and in which case it doesnt make sense.
In Hive, you can get either behavior by {{hive.groupby.orderby.position.alias}}
config. However, important point here is even for queries like {{select
count(*) from t1 group by c1;}} should return no resultset for empty table.
group by 1 essentially mean.. treat all rows as one grouping, so in case for
empty table group by 1 should return no rows and just select count(*) from t1
should return row with value 0.
> StatsOptimizer should return no rows on empty table with group by
> -----------------------------------------------------------------
>
> Key: HIVE-13452
> URL: https://issues.apache.org/jira/browse/HIVE-13452
> Project: Hive
> Issue Type: Bug
> Components: Logical Optimizer
> Reporter: Ashutosh Chauhan
> Assignee: Pengcheng Xiong
>
> {code}
> create table t1 (a int);
> analyze table t1 compute statistics;
> analyze table t1 compute statistics for columns;
> select count(1) from t1 group by 1;
> set hive.compute.query.using.stats=true;
> select count(1) from t1 group by 1;
> {code}
> In both cases result set should be empty. However, with statsoptimizer on
> Hive returns one row with value 0.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)