anujphadke has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/6023 )

Change subject: IMPALA-4848: Add WIDTH_BUCKET() function
......................................................................


Patch Set 15:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/6023/15/fe/src/main/java/org/apache/impala/analysis/Expr.java
File fe/src/main/java/org/apache/impala/analysis/Expr.java:

http://gerrit.cloudera.org:8080/#/c/6023/15/fe/src/main/java/org/apache/impala/analysis/Expr.java@490
PS15, Line 490:       result = ((ScalarType)result).getMinResolutionDecimal();
> Why do we need this?
When I implemented this using decimalVal. I found a bug.
Without this change -
[localhost:21000] > select width_bucket(29 , 1, 400, 7);
Query: select width_bucket(29 , 1, 400, 7)
Query submitted at: 2017-02-28 18:41:40 (Coordinator: 
http://anuj-OptiPlex-9020:25000)
ERROR: AnalysisException: null
CAUSED BY: IllegalStateException: null

I debugged it and found that
getREsolvedWildCardType() does not return a decimalType for this specific 
sequence when
child(0) -> TinyInt
chile(1) -> tinyInt
child(2) -> smalInt

result = Type.getAssignmentCompatibleType(result, childType, false);

when the result is Decimal(3,0) and childType is SMALLINT the result  it 
returns is a result which is SMALLINT.

The query hits this check and fails -
Preconditions.checkState(result.isDecimal() && !result.isWildcardDecimal());

Had discussed this with Alex and he mentioned that we can fix this as part of 
this change.



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I081bc916b1bef7b929ca161a9aade3b54c6b858f
Gerrit-Change-Number: 6023
Gerrit-PatchSet: 15
Gerrit-Owner: anujphadke <[email protected]>
Gerrit-Reviewer: Alex Behm <[email protected]>
Gerrit-Reviewer: Dan Hecht <[email protected]>
Gerrit-Reviewer: Michael Brown <[email protected]>
Gerrit-Reviewer: Taras Bobrovytsky <[email protected]>
Gerrit-Reviewer: Tim Armstrong <[email protected]>
Gerrit-Reviewer: anujphadke <[email protected]>
Gerrit-Comment-Date: Sat, 26 May 2018 03:59:38 +0000
Gerrit-HasComments: Yes

Reply via email to