Skip to content

Commit b4cc8d3

Browse files
committed
HIVE-29433: ClassCastException in FilterLongColumnBetween.evaluate when vectorization is enabled: DecimalColumnVector cannot be cast to class LongColumnVector
1 parent 1246e83 commit b4cc8d3

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,10 @@ private boolean checkExprNodeDescForDecimal64(ExprNodeDesc exprNodeDesc) throws
17171717
GenericUDF udf = ((ExprNodeGenericFuncDesc) exprNodeDesc).getGenericUDF();
17181718
Class<?> udfClass = udf.getClass();
17191719
if (udf instanceof GenericUDFToDecimal) {
1720+
ExprNodeDesc child = exprNodeDesc.getChildren().get(0);
1721+
if (isDecimalFamily(child.getTypeString())) {
1722+
return checkExprNodeDescForDecimal64(child);
1723+
}
17201724
return true;
17211725
}
17221726
// We have a class-level annotation that says whether the UDF's vectorization expressions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE TABLE test_stats0 (e decimal(38,10)) stored as orc;
2+
insert into test_stats0 (e) values (0.0);
3+
4+
set hive.vectorized.execution.enabled=false;
5+
select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0;
6+
7+
8+
set hive.vectorized.execution.enabled=true;
9+
select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PREHOOK: query: CREATE TABLE test_stats0 (e decimal(38,10)) stored as orc
2+
PREHOOK: type: CREATETABLE
3+
PREHOOK: Output: database:default
4+
PREHOOK: Output: default@test_stats0
5+
POSTHOOK: query: CREATE TABLE test_stats0 (e decimal(38,10)) stored as orc
6+
POSTHOOK: type: CREATETABLE
7+
POSTHOOK: Output: database:default
8+
POSTHOOK: Output: default@test_stats0
9+
PREHOOK: query: insert into test_stats0 (e) values (0.0)
10+
PREHOOK: type: QUERY
11+
PREHOOK: Input: _dummy_database@_dummy_table
12+
PREHOOK: Output: default@test_stats0
13+
POSTHOOK: query: insert into test_stats0 (e) values (0.0)
14+
POSTHOOK: type: QUERY
15+
POSTHOOK: Input: _dummy_database@_dummy_table
16+
POSTHOOK: Output: default@test_stats0
17+
POSTHOOK: Lineage: test_stats0.e SCRIPT []
18+
PREHOOK: query: select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0
19+
PREHOOK: type: QUERY
20+
PREHOOK: Input: default@test_stats0
21+
#### A masked pattern was here ####
22+
POSTHOOK: query: select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0
23+
POSTHOOK: type: QUERY
24+
POSTHOOK: Input: default@test_stats0
25+
#### A masked pattern was here ####
26+
0
27+
PREHOOK: query: select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0
28+
PREHOOK: type: QUERY
29+
PREHOOK: Input: default@test_stats0
30+
#### A masked pattern was here ####
31+
POSTHOOK: query: select count(*) from test_stats0 where CAST(e as DECIMAL(15,1)) BETWEEN 100.0 AND 1000.0
32+
POSTHOOK: type: QUERY
33+
POSTHOOK: Input: default@test_stats0
34+
#### A masked pattern was here ####
35+
0

0 commit comments

Comments
 (0)