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

Distinct + Groupby with column alias is failing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      After HIVE-16924, below query is failing.

      create table table1 (col1 bigint, col2 string);
      create table table2 (t2_col1 string);
      
      Select distinct col1 as alias_col1
      from table1
      where col2 = (SELECT max(t2_col1) as currentdate from table2 limit 1)
      order by col1;
      
      Error: Error while compiling statement: FAILED: SemanticException Line 0:-1 Unsupported SubQuery Expression '1': Only SubQuery expressions that are top level conjuncts are allowed (state=42000,code=40000) 

      Workaround is either remove distinct column alias "alias_col1" or use alias in order by.

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              nareshpr Naresh P R
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h 40m
                  3h 40m