deniskuzZ commented on code in PR #6074:
URL: https://github.com/apache/hive/pull/6074#discussion_r2355738440


##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveSchemaConverter.java:
##########
@@ -129,24 +162,42 @@ Type convertType(TypeInfo typeInfo) {
         StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
         List<Types.NestedField> fields =
             convertInternal(structTypeInfo.getAllStructFieldNames(), 
structTypeInfo.getAllStructFieldTypeInfos(),
-                    Collections.emptyList());
+                    Collections.emptyList(), 
getDefaultValuesMap(defaultValue));
         return Types.StructType.of(fields);
       case MAP:
         MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
         int keyId = id++;
-        Type keyType = convertType(mapTypeInfo.getMapKeyTypeInfo());
+        Type keyType = convertType(mapTypeInfo.getMapKeyTypeInfo(), 
defaultValue);
         int valueId = id++;
-        Type valueType = convertType(mapTypeInfo.getMapValueTypeInfo());
+        Type valueType = convertType(mapTypeInfo.getMapValueTypeInfo(), 
defaultValue);
         return Types.MapType.ofOptional(keyId, valueId, keyType, valueType);
       case LIST:
         ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
         int listId = id++;
-        Type listType = convertType(listTypeInfo.getListElementTypeInfo());
+        Type listType = convertType(listTypeInfo.getListElementTypeInfo(), 
defaultValue);
         return Types.ListType.ofOptional(listId, listType);
       case VARIANT:
         return Types.VariantType.get();
       default:
         throw new IllegalArgumentException("Unknown type " + 
typeInfo.getCategory());
     }
   }
+
+  private Map<String, String> getDefaultValuesMap(String defaultValue) {
+    if (defaultValue == null || defaultValue.isEmpty()) {
+      return Collections.emptyMap();
+    }
+    // For Struct, the default value is expected to be in key:value format
+    return Arrays.stream(stripQuotes(defaultValue).split(","))

Review Comment:
   would it be better to use guava splitter here?
   ````
   Splitter.on(',').trimResults().withKeyValueSeparator(':')
     .split(stripQuotes(defaultValue))
   ````



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to