This is an automated email from the ASF dual-hosted git repository.
deniskuzZ pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 35cfd46d884 HIVE-29682: Vectorized MapJoin throws ClassCastException
when processing spilled DECIMAL_64 columns (#6564)
35cfd46d884 is described below
commit 35cfd46d884f8cea03699ed7b6411da75cd3aaa1
Author: Raghav Aggarwal <[email protected]>
AuthorDate: Fri Jun 26 13:47:31 2026 +0530
HIVE-29682: Vectorized MapJoin throws ClassCastException when processing
spilled DECIMAL_64 columns (#6564)
---
.../hive/ql/exec/vector/VectorizedBatchUtil.java | 6 +--
.../ql/exec/vector/TestVectorizedBatchUtil.java | 59 ++++++++++++++++++++++
2 files changed, 62 insertions(+), 3 deletions(-)
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedBatchUtil.java
b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedBatchUtil.java
index cfa846e6877..4be9e1435f0 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedBatchUtil.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizedBatchUtil.java
@@ -520,17 +520,17 @@ private static void setVector(Object row,
}
break;
case DECIMAL:
- DecimalColumnVector dcv = (DecimalColumnVector) batch.cols[offset +
colIndex];
+ ColumnVector dcv = batch.cols[offset + colIndex];
if (writableCol != null) {
dcv.isNull[rowIndex] = false;
HiveDecimalWritable wobj = (HiveDecimalWritable) writableCol;
- dcv.set(rowIndex, wobj);
+ ((IDecimalColumnVector) dcv).set(rowIndex, wobj);
} else {
setNullColIsNullValue(dcv, rowIndex);
}
break;
default:
- throw new HiveException("Vectorizaton is not supported for datatype:" +
+ throw new HiveException("Vectorization is not supported for datatype:" +
poi.getPrimitiveCategory());
}
}
diff --git
a/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizedBatchUtil.java
b/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizedBatchUtil.java
new file mode 100644
index 00000000000..8d1b4276b68
--- /dev/null
+++
b/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorizedBatchUtil.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hadoop.hive.ql.exec.vector;
+
+import java.util.List;
+
+import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
+import
org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.io.DataOutputBuffer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestVectorizedBatchUtil {
+
+ @Test
+ public void testSetDecimal64ColumnVector() throws Exception {
+ Decimal64ColumnVector dec64ColVector = new Decimal64ColumnVector(10, 2);
+ VectorizedRowBatch batch = new VectorizedRowBatch(1);
+ batch.cols[0] = dec64ColVector;
+
+ Object[] row = new Object[] {new HiveDecimalWritable("123.45")};
+
+ StructObjectInspector oi =
+ ObjectInspectorFactory.getStandardStructObjectInspector(
+ List.of("col1"),
+
List.of(PrimitiveObjectInspectorFactory.writableHiveDecimalObjectInspector));
+
+ DataOutputBuffer buffer = new DataOutputBuffer();
+
+ try {
+ VectorizedBatchUtil.addProjectedRowToBatchFrom(row, oi, 0, batch,
buffer);
+
+ Assert.assertEquals(12345L, dec64ColVector.vector[0]);
+ } catch (ClassCastException e) {
+ Assert.fail(
+ "ClassCastException thrown when adding projected row with
Decimal64ColumnVector: "
+ + e.getMessage());
+ }
+ }
+}