Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Query fails with 'Invalid column reference' error if the column in Order by clause is not referenced similar to Group By clause. Like below 2 queries will compile correctly but the third one will fail. Attached repro.q
CREATE VIEW view_order_by_test AS SELECT to_date(`order_by_test`.`result_date`) AS `process_date`,COUNT AS `count` FROM `order_by_test` GROUP BY to_date(`order_by_test`.`result_date`) ORDER BY to_date(`order_by_test`.`result_date`) DESC; ---Successful CREATE VIEW view_order_by_test AS SELECT to_date(`result_date`) AS `process_date`,COUNT AS `count` FROM `order_by_test` GROUP BY to_date(`result_date`) ORDER BY to_date(`result_date`) DESC; --Successful CREATE VIEW view_order_by_test AS SELECT to_date(`order_by_test`.`result_date`) AS `process_date`,COUNT AS `count` FROM `order_by_test` GROUP BY to_date(`order_by_test`.`result_date`) ORDER BY to_date(`result_date`) DESC; --Failure
Both column name and alias use should be supported for the "ORDER BY" clause.
Attachments
Attachments
Issue Links
- is related to
-
HIVE-26054 Distinct + Groupby with column alias is failing
- Resolved