Daniel Becker has posted comments on this change. ( http://gerrit.cloudera.org:8080/19790 )
Change subject: IMPALA-12042: Invalid casts in set operations calculation ...................................................................... Patch Set 2: (16 comments) http://gerrit.cloudera.org:8080/#/c/19790/2//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/19790/2//COMMIT_MSG@11 PS2, Line 11: combinations Nit: combination http://gerrit.cloudera.org:8080/#/c/19790/2//COMMIT_MSG@12 PS2, Line 12: (nCr) What does this mean? http://gerrit.cloudera.org:8080/#/c/19790/2//COMMIT_MSG@12 PS2, Line 12: current The current approach could mean the one used before this change, "the new approach" or "the approach introduced by this change" would be better. http://gerrit.cloudera.org:8080/#/c/19790/2//COMMIT_MSG@13 PS2, Line 13: problem by grouping the available types in the statement's slots and Could you explain the algorithm in a bit more detail? How we group types (unifying parametric types) and why this approach is correct - will it catch every inconsistency? Does the order of the elements matter? http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/Analyzer.java File fe/src/main/java/org/apache/impala/analysis/Analyzer.java: http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/Analyzer.java@3285 PS2, Line 3285: Throw Nit: we could change it to "Throws". http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java File fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java: http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@48 PS2, Line 48: Restructuring Transpose would be more descriptive. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@49 PS2, Line 49: restructuredList Could be 'transposedList'. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@50 PS2, Line 50: int Nit: could be final. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@50 PS2, Line 50: int bound = firstList.size(); We could add a precondition check somewhere that checks that all lists have the same length. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@93 PS2, Line 93: common Nit: "a common type". http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@94 PS2, Line 94: type You could write more about how types are grouped, i.e. that this is about unifying for example CHAR(n) for all n etc. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@96 PS2, Line 96: combinations You could mention that after unifying parametric types (CHAR, VARCHAR) the remaining number of types is small so we can work with the combination. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@126 PS2, Line 126: compatibleTypes.add(new TypeWithOrigin(t2.originExpr_, compatibleType)); What if 'compatibleType' is neither 't1' nor 't2'? For example if t1 is VARCHAR(2), t2 is VARCHAR(3) we can end up here: https://github.com/apache/impala/blob/c8aa5796d93510723342055cc70cf8d00abae754/fe/src/main/java/org/apache/impala/catalog/ScalarType.java#L468 And the common type will be VARCHAR(3). http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@149 PS2, Line 149: private final Expr originExpr_; I would put these private members after the overridden public functions OR before the constructors. http://gerrit.cloudera.org:8080/#/c/19790/2/fe/src/main/java/org/apache/impala/analysis/SetCompatibilityHandler.java@170 PS2, Line 170: * Helper class to make 'Type' class ordering possible in set operations. Could you explain in more detail while this is needed and how it's achieved? http://gerrit.cloudera.org:8080/#/c/19790/2/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/19790/2/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java@3561 PS2, Line 3561: // Transitive compatibility is not allowed (boolean -> tinyint -> decimal(4,1)) You could add: "Regression test for IMPALA-12042: ...". -- To view, visit http://gerrit.cloudera.org:8080/19790 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I02df42c67deda37b7f71db267dc761778a9caa2b Gerrit-Change-Number: 19790 Gerrit-PatchSet: 2 Gerrit-Owner: Peter Rozsa <[email protected]> Gerrit-Reviewer: Daniel Becker <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Peter Rozsa <[email protected]> Gerrit-Comment-Date: Mon, 24 Apr 2023 13:39:53 +0000 Gerrit-HasComments: Yes
