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

Window PARTITION BY clause throw "ParseException line ?:? missing ) at '?' near"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.1.0
    • None
    • Hive
    • None

    Description

      Queries such as:

      SELECT
      LEAD(True, 54) OVER (PARTITION BY (a1.smallint_col_18) / (a1.decimal0101_col_25)) AS boolean_col
      FROM table_10 a1;
      

      throw the exception:

      Error: Error while compiling statement: FAILED: ParseException line 2:55 missing ) at '/' near ')'
      line 2:80 missing EOF at ')' near ')' (state=42000,code=40000)
      

      While the following queries succeed:

      SELECT
      LEAD(True, 54) OVER (PARTITION BY (a1.smallint_col_18 / a1.decimal0101_col_25)) AS boolean_col
      FROM table_10 a1;
      
      SELECT
      LEAD(True, 54) OVER (PARTITION BY (a1.smallint_col_18 / a1.decimal0101_col_25) ORDER BY (a1.smallint_col_18) / (a1.decimal0101_col_25) DESC) AS boolean_col
      FROM table_10 a1;
      

      Seems to be a Hive bug, seems to be related to the extra parenthesis around the a1.smallint_col_18. Hive probably thinks that whatever is inside the () contains the entire clause for PARTITION BY and it fails to parse anything after that.

      My guess is that there is an issue with the Antlr code for the PARTITION BY clause.

      Attachments

        Activity

          People

            Unassigned Unassigned
            stakiar Sahil Takiar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: