Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-21620

GROUPBY position alias not working with STREAMTABLE hint

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3.2
    • None
    • Parser
    • None
    • Patch

    Description

      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.
       
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            dac Da Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 8h
                8h
                Remaining:
                Remaining Estimate - 8h
                8h
                Logged:
                Time Spent - Not Specified
                Not Specified