[
https://issues.apache.org/jira/browse/HIVE-5129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13745873#comment-13745873
]
Navis commented on HIVE-5129:
-----------------------------
mGBY-1RS optimization is really confusing with distinct functions. IMHO, it
should not be allowed to mix distinct and non-distinct cases into one group.
For example,
{noformat}
from src tablesample (10 ROWS)
insert overwrite table src_a select key, count(distinct key) + count(distinct
value) group by key;
{noformat}
makes 20 rows for src_a, and,
{noformat}
from src tablesample (10 ROWS)
insert overwrite table src_b select key, count(value) group by key, value;
{noformat}
makes 10 rows for src_b, but,
{noformat}
from src tablesample (10 ROWS)
insert overwrite table src_a select key, count(distinct key) + count(distinct
value) group by key
insert overwrite table src_b select key, count(value) group by key, value;
{noformat}
makes 20 rows for src_a and src_b, and lastly,
{noformat}
from src tablesample (10 ROWS)
insert overwrite table src_b select key, count(value) group by key, value
insert overwrite table src_a select key, count(distinct key) + count(distinct
value) group by key;
{noformat}
is not working as described in this issue. After applying your patch, it
succeeded with 10 rows for both.
> Multiple table insert fails on count(distinct)
> ----------------------------------------------
>
> Key: HIVE-5129
> URL: https://issues.apache.org/jira/browse/HIVE-5129
> Project: Hive
> Issue Type: Bug
> Components: Query Processor
> Affects Versions: 0.11.0
> Reporter: Vikram Dixit K
> Assignee: Vikram Dixit K
> Attachments: aggrTestMultiInsertData1.txt,
> aggrTestMultiInsertData.txt, aggrTestMultiInsert.q, HIVE-5129.1.patch.txt
>
>
> Hive fails with a class cast exception on queries of the form:
> {noformat}
> from studenttab10k
> insert overwrite table multi_insert_2_1
> select name, avg(age) as avgage
> group by name
> insert overwrite table multi_insert_2_2
> select name, age, sum(gpa) as sumgpa
> group by name, age
> insert overwrite table multi_insert_2_3
> select name, count(distinct age) as distage
> group by name;
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira