You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Da Cheng <da...@twitter.com> on 2019/04/11 02:27:12 UTC

GROUPBY position alias not working with STREAMTABLE hint

Hello everyone,

When I use STREAMTABLE hint for JOINs, GROUPBY index failed to skip the
hint to select the right column. Take following query for example, I wanted
to group by 'user', but the '1' index in GROUPBY clause actually points to
the hint '*/*+ STREAMTABLE(xyz) */*' other than the actual 'user' column.
Hence Hive errors out complaining: "Expression not in GROUP BY key 'user'"

To make the query work, I need to manually skip the hint by using 'group by
2' instead of 'group by 1'.
(Note that the STREAMTABLE hint is dummy in the query since there is no
JOIN. It's just to reproduce the error.)

Are you aware of issue and solutions to fix it? We have a fix at our
branch, but want to check if there is already a better fix existing.

************
select
    /*+ STREAMTABLE(xyz) */
    user,
    sum(score)
from
    test.roster
group by 1
************

Da