Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
Impala 2.8.0
-
None
Description
[localhost:21000] > select 1 from (select id, max(int_col) foo from functional.alltypes cc GROUP BY id HAVING (foo < 1) or (foo < 1)) most_recent; Query: select 1 from (select id, max(int_col) foo from functional.alltypes cc GROUP BY id HAVING (foo < 1) or (foo < 1)) most_recent Query submitted at: 2017-01-06 13:43:11 (Coordinator: http://hnr-optiplex:25000) ERROR: AnalysisException: Could not resolve column/field reference: 'foo'
If the query is run with ENABLE_EXPR_REWRITES=0; it completes successfully.
The bug is sensitive to the structure of the HAVING clause (it's there that the error seems to get thrown from during analysis). If, for example, we have HAVING (foo < 1) or (foo < 2) the query succeeds. However, I've seen a more elaborate reproduction where the disjuncts were not tautological (basically (foo < X) OR (foo < Y) for X < Y).
Adding extra redundant clauses (like OR FALSE)) often removes the bug as well.