Zoltan Borok-Nagy has posted comments on this change. ( http://gerrit.cloudera.org:8080/8801 )
Change subject: IMPALA-5191: Standardize column alias behavior ...................................................................... Patch Set 9: (4 comments) Thanks! http://gerrit.cloudera.org:8080/#/c/8801/9/fe/src/main/java/org/apache/impala/analysis/QueryStmt.java File fe/src/main/java/org/apache/impala/analysis/QueryStmt.java: http://gerrit.cloudera.org:8080/#/c/8801/9/fe/src/main/java/org/apache/impala/analysis/QueryStmt.java@274 PS9, Line 274: * If we substitute by ordinal, we should not replace any aliases, since the > Simpler: We should substitute by ordinal or alias but not both to avoid an Done http://gerrit.cloudera.org:8080/#/c/8801/9/fe/src/main/java/org/apache/impala/analysis/QueryStmt.java@278 PS9, Line 278: * If 'expr' is a NumericLiteral, then it can be interpreted as an ordinal, > Integrate this into L271, i.e.: Thanks, it is much cleaner that way. http://gerrit.cloudera.org:8080/#/c/8801/9/fe/src/main/java/org/apache/impala/analysis/QueryStmt.java@304 PS9, Line 304: * Substitute top-level exprs of the form "<number>" with the corresponding > Substitutes top-level ordinals and aliases. Does not substitute ordinals an Done http://gerrit.cloudera.org:8080/#/c/8801/7/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java File fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java: http://gerrit.cloudera.org:8080/#/c/8801/7/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java@985 PS7, Line 985: // IMPALA-5191: In GROUP BY, HAVING, ORDER BY, aliases and ordinals must only be > Did you address this issue with constant folding and ordinals? Sorry, I overlooked this comment. I implemented the behavior you described, and now as far as I can tell Impala's behavior is aligned with PostgreSQL. This means 'select int_col, count(*) from functional.alltypes group by 1*2, int_col' works, and the constant expression 1*2 basically has no effect on the result of the query. So only the expressions that are numeric literals originally are interpreted as ordinals. Constant arithmetic expressions have basically no observable effect, which is strange for me (I'd rather raise an error), but again, this is what PostgreSQL is doing. -- To view, visit http://gerrit.cloudera.org:8080/8801 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I0f82483b486acf6953876cfa672b0d034f3709a8 Gerrit-Change-Number: 8801 Gerrit-PatchSet: 9 Gerrit-Owner: Zoltan Borok-Nagy <borokna...@cloudera.com> Gerrit-Reviewer: Alex Behm <alex.b...@cloudera.com> Gerrit-Reviewer: Taras Bobrovytsky <tbobrovyt...@cloudera.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com> Gerrit-Reviewer: Zoltan Borok-Nagy <borokna...@cloudera.com> Gerrit-Comment-Date: Tue, 16 Jan 2018 11:42:28 +0000 Gerrit-HasComments: Yes