Da Cheng created HIVE-21620:
-------------------------------

             Summary: GROUPBY position alias not working with STREAMTABLE hint
                 Key: HIVE-21620
                 URL: https://issues.apache.org/jira/browse/HIVE-21620
             Project: Hive
          Issue Type: Bug
          Components: Parser
    Affects Versions: 2.3.2
            Reporter: Da Cheng


Hi team,
 
When STREAMTABLE hint is used for JOINs, GROUPBY index fails 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'"
 
************
select
    /*+ STREAMTABLE(xyz) */
    user,
    sum(score)
from 
    test.roster
group by 1
************
 
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 added just to reproduce the error.)
 
We have made a patch at our local branch and tested it's working fine. If you 
have seen similar issues, feel free to apply our patch to your branch. Next we 
will create a PR for the patch for review. Please advise if I missed anything.
 
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to