Alex Behm has posted comments on this change. ( http://gerrit.cloudera.org:8080/8398 )
Change subject: IMPALA-3436: Return a decimal when rounding a double ...................................................................... Patch Set 3: Code-Review+1 (4 comments) I'm happy with the FE changes. Would be good to get a second pair of eyes on the BE portion. http://gerrit.cloudera.org:8080/#/c/8398/1/be/src/exprs/decimal-functions-ir.cc File be/src/exprs/decimal-functions-ir.cc: http://gerrit.cloudera.org:8080/#/c/8398/1/be/src/exprs/decimal-functions-ir.cc@111 PS1, Line 111: DCHECK(!scale.is_null); > Added a test. Agree it's good to be consistent, but it might bite users when we switch DECIMAL_V2 to the default (their queries that have non-constant args in round() will not analyze). We should be sure to clearly document this new behavior/limitation. http://gerrit.cloudera.org:8080/#/c/8398/1/common/function-registry/impala_functions.py File common/function-registry/impala_functions.py: http://gerrit.cloudera.org:8080/#/c/8398/1/common/function-registry/impala_functions.py@284 PS1, Line 284: # TODO: Remove when DECIMAL_V1 is removed. > Because what if someone typed in "select dround(x)". We need to be able to Good point. I was thinking dround() vs round() in toSql() doesn't matter that much, but probably it's better to preserve the existing behavior like you suggest. http://gerrit.cloudera.org:8080/#/c/8398/3/common/function-registry/impala_functions.py File common/function-registry/impala_functions.py: http://gerrit.cloudera.org:8080/#/c/8398/3/common/function-registry/impala_functions.py@289 PS3, Line 289: [['round','dround','round_v1','dround_v1'], This function is used both decimal_v1/v2 modes. http://gerrit.cloudera.org:8080/#/c/8398/3/fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java File fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java: http://gerrit.cloudera.org:8080/#/c/8398/3/fe/src/test/java/org/apache/impala/analysis/AnalyzeExprsTest.java@2439 PS3, Line 2439: AnalyzesOk("select round(cast(1.123 as double), int_col) from functional.alltypes", add a positive test with a non-NULL constant second argument to both v1/v2 -- To view, visit http://gerrit.cloudera.org:8080/8398 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I240ec70da7996bbfefcf6438eba4dff8d33d7bd6 Gerrit-Change-Number: 8398 Gerrit-PatchSet: 3 Gerrit-Owner: Taras Bobrovytsky <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Taras Bobrovytsky <[email protected]> Gerrit-Comment-Date: Tue, 07 Nov 2017 01:26:21 +0000 Gerrit-HasComments: Yes
