From b4debc62d5fb615b2b6910187ca389ba4e17a633 Mon Sep 17 00:00:00 2001 From: Chenhao Li Date: Wed, 8 Nov 2023 16:37:39 -0800 Subject: [PATCH] add missing code --- .../java/org/apache/spark/sql/vectorized/ColumnarBatchRow.java | 2 ++ .../spark/sql/execution/vectorized/ColumnVectorUtils.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sql/catalyst/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatchRow.java b/sql/catalyst/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatchRow.java index f91f2890c19c2..ac23f70584e89 100644 --- a/sql/catalyst/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatchRow.java +++ b/sql/catalyst/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatchRow.java @@ -188,6 +188,8 @@ public Object get(int ordinal, DataType dataType) { return getStruct(ordinal, ((StructType)dataType).fields().length); } else if (dataType instanceof MapType) { return getMap(ordinal); + } else if (dataType instanceof VariantType) { + return getVariant(ordinal); } else { throw new UnsupportedOperationException("Datatype not supported " + dataType); } diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java index 6f0e2d37bfe8b..29c106651acf0 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java @@ -90,6 +90,8 @@ public static void populate(ConstantColumnVector col, InternalRow row, int field } else if (pdt instanceof PhysicalCalendarIntervalType) { // The value of `numRows` is irrelevant. col.setCalendarInterval((CalendarInterval) row.get(fieldIdx, t)); + } else if (pdt instanceof PhysicalVariantType) { + col.setVariant((VariantVal)row.get(fieldIdx, t)); } else { throw new RuntimeException(String.format("DataType %s is not supported" + " in column vectorized reader.", t.sql()));