Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/8448 )
Change subject: IMPALA-6114: Require type equality for NumericLiteral::localEquals(). ...................................................................... IMPALA-6114: Require type equality for NumericLiteral::localEquals(). This patch fixes a regression introduced as part of IMPALA-1788, where an expression like 'CAST(0 AS DECIMAL(14))' is rewritten as a NumericLiteral expression of type DECIMAL(14,0). The query had another NumericLiteral of type TINYINT. While analyzing the DISTINCT aggregation clause of the SELECT query, AggregateInfo::create() removes duplicate expressions from groupingExprs. NumericLiteral::localEquals() is used to check for equality. Now since the method does not consider expression types, a TINYINT literal is considered to be duplicate of a DECIMAL literal. This results in a query like the following to fail: SELECT DISTINCT CAST(0 AS DECIMAL(14), 0 FROM functional.alltypes We propose to fix the issue by accounting for types as well when comparing analyzed numeric literals. A test case has been added to AnalyzeStmtsTest. Change-Id: Ia88d54088dfd128b103759dc01103b6c35bf6257 Reviewed-on: http://gerrit.cloudera.org:8080/8448 Reviewed-by: Alex Behm <alex.b...@cloudera.com> Tested-by: Impala Public Jenkins --- M fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java 2 files changed, 11 insertions(+), 1 deletion(-) Approvals: Alex Behm: Looks good to me, approved Impala Public Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/8448 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ia88d54088dfd128b103759dc01103b6c35bf6257 Gerrit-Change-Number: 8448 Gerrit-PatchSet: 7 Gerrit-Owner: Zoram Thanga <zo...@cloudera.com> Gerrit-Reviewer: Alex Behm <alex.b...@cloudera.com> Gerrit-Reviewer: Bharath Vissapragada <bhara...@cloudera.com> Gerrit-Reviewer: Dimitris Tsirogiannis <dtsirogian...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins Gerrit-Reviewer: Michael Ho <k...@cloudera.com> Gerrit-Reviewer: Zoram Thanga <zo...@cloudera.com>