Hi
I am analyzing some query errors from projection expressions not
matching grouping: /"select list expression not produced by aggregation
output"/
Doing some simplified test queries I ended up in a scenario where I
don't see if the results are expected or a limitation/bug on Impala.
This works:
SELECT CASE WHEN -1 > 0 THEN t0.<field name> ELSE 'X' END
FROM <table name> t0
GROUP BY CASE WHEN -1 > 0 THEN t0.<field name> ELSE 'X' END;
However this one where the results come from the field do not work:
/SELECT CASE WHEN -1 < 0 THEN t0.<field name> ELSE 'X' END/
/FROM <table name> t0/
/GROUP BY CASE WHEN -1 < 0 THEN t0.<field name> ELSE 'X' END;/
This one works:
SELECT CASE WHEN t0.<field name> = 'b' THEN 'found' ELSE t0.<field name> END
FROM /<table name>/ t0
GROUP BY WHEN t0.<field name> = 'b' THEN 'found' ELSE t0.<field name> END;
However not using the field reference does not work (even if the result
is the same):
SELECT CASE WHEN 'a' = 'b' THEN 'found' ELSE t0.summary END
FROM /<table name>/t0
GROUP BY CASE WHEN 'a' = 'b'THEN 'found' ELSE t0.summaryEND;
I could only find this JIRA as somehow related but it is from 2015
https://issues.apache.org/jira/browse/DRILL-1927 (Aggregation or
Group-By on a CASE expression with IN subquery fails)
Any one knows if this is somehow expected, limitation or bug? I
have tested this on 3.4.0 version
Best regards,
Jacobo Sánchez