pvary commented on code in PR #14245:
URL: https://github.com/apache/iceberg/pull/14245#discussion_r2414574923


##########
flink/v2.1/flink/src/test/java/org/apache/iceberg/flink/HadoopTableExtension.java:
##########
@@ -18,42 +18,95 @@
  */
 package org.apache.iceberg.flink;
 
+import java.util.Map;
 import org.apache.iceberg.PartitionSpec;
 import org.apache.iceberg.Schema;
 import org.apache.iceberg.Table;
+import org.apache.iceberg.TableProperties;
 import org.apache.iceberg.catalog.TableIdentifier;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
 import org.junit.jupiter.api.extension.ExtensionContext;
 
 public class HadoopTableExtension extends HadoopCatalogExtension {
   private final Schema schema;
   private final PartitionSpec partitionSpec;
+  private final Map<String, String> properties;
 
   private Table table;
 
   public HadoopTableExtension(String database, String tableName, Schema 
schema) {
-    this(database, tableName, schema, null);
+    this(database, tableName, schema, null, null);
   }
 
   public HadoopTableExtension(
       String database, String tableName, Schema schema, PartitionSpec 
partitionSpec) {
+    this(database, tableName, schema, partitionSpec, null);
+  }
+
+  public HadoopTableExtension(
+      String database, String tableName, Schema schema, Map<String, String> 
properties) {
+    this(database, tableName, schema, null, properties);
+  }
+
+  public HadoopTableExtension(
+      String database,
+      String tableName,
+      Schema schema,
+      PartitionSpec partitionSpec,
+      Map<String, String> properties) {
     super(database, tableName);
     this.schema = schema;
     this.partitionSpec = partitionSpec;
+    this.properties = properties;
   }
 
   @Override
   public void beforeEach(ExtensionContext context) throws Exception {
     super.beforeEach(context);
     if (partitionSpec == null) {
-      this.table = catalog.createTable(TableIdentifier.of(database, 
tableName), schema);
+      if (properties == null) {
+        this.table = catalog.createTable(TableIdentifier.of(database, 
tableName), schema);
+      } else {
+        this.table =
+            catalog.createTable(
+                TableIdentifier.of(database, tableName),
+                schema,
+                PartitionSpec.unpartitioned(),
+                null,
+                properties);
+      }
     } else {
-      this.table =
-          catalog.createTable(TableIdentifier.of(database, tableName), schema, 
partitionSpec);
+      if (properties == null) {
+        this.table =
+            catalog.createTable(TableIdentifier.of(database, tableName), 
schema, partitionSpec);
+      } else {
+        this.table =
+            catalog.createTable(
+                TableIdentifier.of(database, tableName), schema, 
partitionSpec, null, properties);
+      }
     }
     tableLoader.open();
   }
 
   public Table table() {
     return table;
   }
+
+  /** Create a HadoopTableExtension with format version 3 for nanosecond 
timestamp support. */
+  public static HadoopTableExtension withFormatVersion3(
+      String database, String tableName, Schema schema) {
+    return new HadoopTableExtension(
+        database, tableName, schema, 
ImmutableMap.of(TableProperties.FORMAT_VERSION, "3"));
+  }
+
+  /** Create a HadoopTableExtension with format version 3 for nanosecond 
timestamp support. */
+  public static HadoopTableExtension withFormatVersion3(

Review Comment:
   Is this used?



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