RussellSpitzer commented on code in PR #17196:
URL: https://github.com/apache/iceberg/pull/17196#discussion_r3590914619


##########
core/src/main/java/org/apache/iceberg/avro/AvroSchemaUtil.java:
##########
@@ -56,37 +56,75 @@ private AvroSchemaUtil() {}
   private static final Schema.Type RECORD = Schema.Type.RECORD;
 
   public static Schema convert(org.apache.iceberg.Schema schema, String 
tableName) {
-    return convert(schema, ImmutableMap.of(schema.asStruct(), tableName));
+    return convert(schema, tableName, true);
+  }
+
+  public static Schema convert(
+      org.apache.iceberg.Schema schema, String tableName, boolean 
legacyTimestampMapping) {
+    return convert(schema, ImmutableMap.of(schema.asStruct(), tableName), 
legacyTimestampMapping);
   }
 
   public static Schema convert(
       org.apache.iceberg.Schema schema, Map<Types.StructType, String> names) {
-    return TypeUtil.visit(schema, new TypeToSchema.WithTypeToName(names));
+    return convert(schema, names, true);
+  }
+
+  public static Schema convert(
+      org.apache.iceberg.Schema schema,
+      Map<Types.StructType, String> names,
+      boolean legacyTimestampMapping) {
+    return TypeUtil.visit(schema, new TypeToSchema.WithTypeToName(names, 
legacyTimestampMapping));
   }
 
   public static Schema convert(Type type) {
     return convert(type, ImmutableMap.of());
   }
 
   public static Schema convert(Types.StructType type, String name) {
-    return convert(type, ImmutableMap.of(type, name));
+    return convert(type, name, true);
+  }
+
+  public static Schema convert(Types.StructType type, String name, boolean 
legacyTimestampMapping) {
+    return convert(type, ImmutableMap.of(type, name), legacyTimestampMapping);
   }
 
   public static Schema convert(Type type, Map<Types.StructType, String> names) 
{
-    return TypeUtil.visit(type, new TypeToSchema.WithTypeToName(names));
+    return convert(type, names, true);
+  }
+
+  public static Schema convert(
+      Type type, Map<Types.StructType, String> names, boolean 
legacyTimestampMapping) {
+    return TypeUtil.visit(type, new TypeToSchema.WithTypeToName(names, 
legacyTimestampMapping));
   }
 
   public static Schema convert(
       Type type, BiFunction<Integer, Types.StructType, String> namesFunction) {
-    return TypeUtil.visit(type, new 
TypeToSchema.WithNamesFunction(namesFunction));
+    return convert(type, namesFunction, true);
+  }
+
+  public static Schema convert(
+      Type type,
+      BiFunction<Integer, Types.StructType, String> namesFunction,
+      boolean legacyTimestampMapping) {
+    return TypeUtil.visit(
+        type, new TypeToSchema.WithNamesFunction(namesFunction, 
legacyTimestampMapping));
   }
 
   public static Type convert(Schema schema) {
-    return AvroSchemaVisitor.visit(schema, new SchemaToType(schema));
+    return convert(schema, true);
+  }
+
+  public static Type convert(Schema schema, boolean legacyTimestampMapping) {
+    return AvroSchemaVisitor.visit(schema, new SchemaToType(schema, 
legacyTimestampMapping));
   }
 
   public static org.apache.iceberg.Schema toIceberg(Schema schema) {
-    final List<Types.NestedField> fields = 
convert(schema).asNestedType().asStructType().fields();
+    return toIceberg(schema, true);
+  }
+
+  public static org.apache.iceberg.Schema toIceberg(Schema schema, boolean 
legacyTimestampMapping) {
+    final List<Types.NestedField> fields =

Review Comment:
   Stylistically I tink we generally don't want final on local vars



-- 
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