ramitg254 commented on code in PR #6565:
URL: https://github.com/apache/hive/pull/6565#discussion_r3504541644
##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedDummyColumnReader.java:
##########
@@ -64,6 +68,41 @@ public void readBatch(int total, ColumnVector col, TypeInfo
typeInfo) throws IOE
if (typeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE) {
fillPrimitive(col, (PrimitiveTypeInfo) typeInfo, defaultValue);
+ } else if (typeInfo.getCategory() == ObjectInspector.Category.STRUCT) {
+ fillStruct(col, (StructTypeInfo) typeInfo, defaultValue);
+ } else {
+ throw new IOException("Unsupported type category in DummyColumnReader: "
+ typeInfo.getCategory());
+ }
+ }
+
+ private void fillStruct(ColumnVector col, StructTypeInfo structTypeInfo,
Object defaultValue) throws IOException {
+ StructColumnVector structCol = (StructColumnVector) col;
+ List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
+ List<TypeInfo> fieldTypes = structTypeInfo.getAllStructFieldTypeInfos();
+ Map<String, Object> fieldDefaults = defaultValue instanceof Map ?
(Map<String, Object>) defaultValue : null;
Review Comment:
done
##########
ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/VectorizedDummyColumnReader.java:
##########
@@ -64,6 +68,41 @@ public void readBatch(int total, ColumnVector col, TypeInfo
typeInfo) throws IOE
if (typeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE) {
fillPrimitive(col, (PrimitiveTypeInfo) typeInfo, defaultValue);
+ } else if (typeInfo.getCategory() == ObjectInspector.Category.STRUCT) {
+ fillStruct(col, (StructTypeInfo) typeInfo, defaultValue);
+ } else {
+ throw new IOException("Unsupported type category in DummyColumnReader: "
+ typeInfo.getCategory());
+ }
+ }
+
+ private void fillStruct(ColumnVector col, StructTypeInfo structTypeInfo,
Object defaultValue) throws IOException {
+ StructColumnVector structCol = (StructColumnVector) col;
+ List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
+ List<TypeInfo> fieldTypes = structTypeInfo.getAllStructFieldTypeInfos();
+ Map<String, Object> fieldDefaults = defaultValue instanceof Map ?
(Map<String, Object>) defaultValue : null;
+
+ for (int i = 0; i < fieldNames.size(); i++) {
+ Object fieldDefault = fieldDefaults != null ?
fieldDefaults.get(fieldNames.get(i)) : null;
+ fillStructField(structCol.fields[i], fieldTypes.get(i), fieldDefault);
+ }
+ }
+
+ private void fillStructField(ColumnVector col, TypeInfo typeInfo, Object
fieldDefault) throws IOException {
+ if (fieldDefault == null) {
+ col.isRepeating = true;
+ Arrays.fill(col.isNull, true);
+ col.noNulls = false;
+ return;
+ }
+
+ col.isRepeating = true;
+ col.noNulls = true;
+ col.isNull[0] = false;
+
+ if (typeInfo.getCategory() == ObjectInspector.Category.PRIMITIVE) {
+ fillPrimitive(col, (PrimitiveTypeInfo) typeInfo, fieldDefault);
+ } else if (typeInfo.getCategory() == ObjectInspector.Category.STRUCT) {
+ fillStruct(col, (StructTypeInfo) typeInfo, fieldDefault);
Review Comment:
done, refractored
--
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]