Impala Public Jenkins has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/11878 )

Change subject: IMPALA-7805: Emit zero as "0" in toSql()
......................................................................

IMPALA-7805: Emit zero as "0" in toSql()

It turns out that Impala has a somewhat Baroque way to represent the
value of a numeric 0.  NumericLiteral.toSql() uses the Java
BigDecimal class to convert a numeric value to a string for use in
explained plans and in verifying expression rewrites.

The default Java behavior is to consider scale when rendering numbers,
including 0. Thus, depending on precision and scale, you may get:

0
0.0
0.00
0.000
...
0E-38

However, mathematically, zero is zero. Plans attach no special meaning
to the extra decimal points or trailing zeros.

To make testing easier, changed the behavior to always emit "0" when the
value is zero, regardless of precision or scale.

Testing: Reran the planner tests and modified captured plans that had
the 0.0, 0.00 variations of zero.

Since this change affects only EXPLAIN output, it cannot affect the
operation of queries. If may impact other tests that compare EXPLAIN
output to a "golden" copy.

Change-Id: I0b2f2f34fe5e6003de407301310ccf433841b9f1
Reviewed-on: http://gerrit.cloudera.org:8080/11878
Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
---
M fe/src/main/java/org/apache/impala/analysis/NumericLiteral.java
M 
testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test
M testdata/workloads/functional-planner/queries/PlannerTest/tpch-all.test
M testdata/workloads/functional-planner/queries/PlannerTest/tpch-kudu.test
M testdata/workloads/functional-planner/queries/PlannerTest/tpch-nested.test
M testdata/workloads/functional-planner/queries/PlannerTest/tpch-views.test
6 files changed, 28 insertions(+), 21 deletions(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

--
To view, visit http://gerrit.cloudera.org:8080/11878
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b2f2f34fe5e6003de407301310ccf433841b9f1
Gerrit-Change-Number: 11878
Gerrit-PatchSet: 4
Gerrit-Owner: Paul Rogers <par0...@yahoo.com>
Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Gerrit-Reviewer: Philip Zeyliger <phi...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com>

Reply via email to