[ https://issues.apache.org/jira/browse/HIVE-21802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleksiy Sayankin updated HIVE-21802: ------------------------------------ Attachment: sql-2003-2.bnf > Add support of multilpe ORDER BY clause position > ------------------------------------------------ > > Key: HIVE-21802 > URL: https://issues.apache.org/jira/browse/HIVE-21802 > Project: Hive > Issue Type: Bug > Components: Parser, Query Processor > Reporter: Oleksiy Sayankin > Assignee: Oleksiy Sayankin > Priority: Critical > Attachments: HIVE-21802.1.patch, HIVE-21802.2.patch, sql-2003-2.bnf > > > *STEPS TO REPRODUCE:* > 1. Create a table: > {code:java} > CREATE TABLE i (id INT, a1 INT, b1 BOOLEAN); > {code} > 2. Run the query which was working in Hive-1.2: ({{ORDER}} clause _before_ > {{WINDOW}}) > {code:java} > SELECT id > FROM ( > SELECT > id, > a1, > ROW_NUMBER() OVER w1 AS rn, > b1 > FROM i a > ORDER BY id, b1, a1 DESC > WINDOW w1 as (PARTITION BY id, b1 ORDER BY a1 DESC) > ) tmp WHERE rn=1 DISTRIBUTE BY id; > {code} > *ACTUAL RESULT:* > The query fails with an exception you can find above. > The query from Step 2 which works for Hive-2.3 is ( ({{ORDER}} clause _after_ > {{WINDOW}})): > {code:java} > SELECT id > FROM ( > SELECT > id, > a1, > ROW_NUMBER() OVER w1 AS rn, > b1 > FROM i a > WINDOW w1 as (PARTITION BY id, b1 ORDER BY a1 DESC) > ORDER BY id, b1, a1 DESC > ) tmp WHERE rn=1 DISTRIBUTE BY id; > {code} > Hive-2.3 also fails to parse subquery ( ({{ORDER}} clause _before_ > {{WINDOW}})): > {code:java} > SELECT > id, > a1, > ROW_NUMBER() OVER w1 AS rn, > b1 > FROM i a > ORDER BY id, b1, a1 DESC > WINDOW w1 as (PARTITION BY id, b1 ORDER BY a1 DESC) > {code} > Customer is facing issue regularly this is occurring after upgrade . the > workaround given by us need lot of code changes which will get them back to > squire one they need to follow process and will cost them a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)