difin commented on code in PR #6200:
URL: https://github.com/apache/hive/pull/6200#discussion_r2550004877


##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedDummyColumnReader.java:
##########
@@ -18,25 +18,112 @@
 
 package org.apache.hadoop.hive.ql.io.parquet.vector;
 
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
 import org.apache.hadoop.hive.ql.exec.vector.ColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector;
+import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
 import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 /**
- * A dummy vectorized parquet reader to support schema evolution.
+ * A dummy vectorized parquet reader used for schema evolution.
+ * If a default value is provided, it returns that value for the entire batch.
+ * Otherwise, it returns nulls.
  */
 public class VectorizedDummyColumnReader extends BaseVectorizedColumnReader {
 
-  public VectorizedDummyColumnReader() {
+  private final Object defaultValue;
+
+  public VectorizedDummyColumnReader(Object defaultValue) {
     super();
+    this.defaultValue = defaultValue;
   }
 
   @Override
-  public void readBatch(int total, ColumnVector column, TypeInfo columnType) 
throws IOException {
-    Arrays.fill(column.isNull, true);
-    column.isRepeating = true;
-    column.noNulls = false;
+  public void readBatch(int total, ColumnVector col, TypeInfo typeInfo) throws 
IOException {
+
+    // Case 1: No default → (all nulls)
+    if (defaultValue == null) {
+      Arrays.fill(col.isNull, true);
+      col.noNulls = false;
+      col.isRepeating = true;
+      return;
+    }
+
+    // Case 2: We have a default → fill with constant value
+    col.isRepeating = true;
+    col.noNulls = true;
+    col.isNull[0] = false;
+
+    if (typeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE) {
+      fillPrimitive(col, (PrimitiveTypeInfo) typeInfo, defaultValue);
+    } else {
+      throw new IOException("Unsupported type category in DummyColumnReader: " 
+ typeInfo.getCategory());
+    }
+  }
+
+  /* -------------------------
+     Primitive/leaf-type filler
+     ------------------------- */

Review Comment:
   This block comment reads like a section header rather than a method comment. 
Because it’s placed right before the method, it looks like it’s meant to 
document the method — but it doesn’t describe the parameters or behavior.
   It would be better to convert it into a proper JavaDoc (/** ... */) that 
describes the method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to