ramitg254 commented on code in PR #6565:
URL: https://github.com/apache/hive/pull/6565#discussion_r3503940921
##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveSchemaUtil.java:
##########
@@ -154,6 +154,23 @@ public static Type convert(TypeInfo typeInfo, String
defaultValue) {
return HiveSchemaConverter.convert(typeInfo, false, defaultValue);
}
+ public static Type applyInitialDefaultsToStruct(Type type) {
+ Types.StructType struct = type.asStructType();
+ return Types.StructType.of(
+
struct.fields().stream().map(HiveSchemaUtil::applyInitialDefaultsToStructField).toList());
+ }
+
+ private static Types.NestedField
applyInitialDefaultsToStructField(Types.NestedField field) {
+ Types.NestedField.Builder builder = Types.NestedField.from(field);
+ if (field.type().isStructType()) {
+ builder.ofType(applyInitialDefaultsToStruct(field.type()));
+ }
+ if (field.initialDefaultLiteral() == null && field.writeDefaultLiteral()
!= null) {
+ builder.withInitialDefault(field.writeDefaultLiteral());
+ }
Review Comment:
this method is only required for the sake of only cloning the type in case
of adding column as mentioned in
https://github.com/apache/hive/pull/6565/changes/BASE..c96b0695f3a0540b568be3cf1c59e59687260593#r3503931068
when write default will always be same as the initial default
--
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]