Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 2.9.0, Impala 2.10.0, Impala 2.11.0
-
ghx-label-8
Description
Reproduction:
select sum(float_col + d) from (select float_col, 1.2 d from functional.alltypes) v; ERROR: IllegalStateException: Agg expr sum(float_col + 1.2) returns type DOUBLE but its output tuple slot has type DECIMAL(38,9)
FE Stack:
I0113 14:44:36.300395 9285 jni-util.cc:211] java.lang.IllegalStateException: Agg expr sum(f + 1.2) returns type DOUBLE but its output tuple slot has type DECIMAL(38,9) at com.google.common.base.Preconditions.checkState(Preconditions.java:145) at org.apache.impala.analysis.AggregateInfo.checkConsistency(AggregateInfo.java:702) at org.apache.impala.planner.AggregationNode.init(AggregationNode.java:165) at org.apache.impala.planner.SingleNodePlanner.createAggregationPlan(SingleNodePlanner.java:895) at org.apache.impala.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:621) at org.apache.impala.planner.SingleNodePlanner.createQueryPlan(SingleNodePlanner.java:257) at org.apache.impala.planner.SingleNodePlanner.createSingleNodePlan(SingleNodePlanner.java:147) at org.apache.impala.planner.Planner.createPlan(Planner.java:101) at org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1044) at org.apache.impala.service.Frontend.createExecRequest(Frontend.java:1147) at org.apache.impala.service.JniFrontend.createExecRequest(JniFrontend.java:156)
This bug does not happen with DECIMAL_V2=true. It is specific to the implicit casting behavior of DECIMAL_V1 with decimal literals.
Note that the following equivalent query without the inline view works fine:
select sum(float_col + 1.2) from functional.alltypes;
Also note that this bug only happens in combination with a decimal literal. The following query also works fine:
create table t (f float, d decimal (2,1)); select sum(float_col + d) from (select f, d from t) v; // works fine