nastra commented on code in PR #14351:
URL: https://github.com/apache/iceberg/pull/14351#discussion_r2438444063


##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/actions/TestRewriteTablePathsAction.java:
##########
@@ -111,23 +125,20 @@ protected ActionsProvider actions() {
   @BeforeEach
   public void setupTableLocation() {
     this.tableLocation = tableDir.toFile().toURI().toString();
-    this.table = createATableWith2Snapshots(tableLocation);
     createNameSpaces();
   }
 
+  private Map<String, String> properties() {
+    Map<String, String> properties = Maps.newHashMap();
+    properties.put("format-version", String.valueOf(this.formatVersion));
+    return properties;

Review Comment:
   actually I don't think we need that method. Instead of passing the 
properties everywhere, it's better to always set the format-version like this:
   ```
      private Table createTableWithSnapshots(
          String location, int snapshotNumber, Map<String, String> properties, 
String mode) {
   -    Table newTable = TABLES.create(SCHEMA, PartitionSpec.unpartitioned(), 
properties, location);
   +    Table newTable =
   +        TABLES.create(
   +            SCHEMA,
   +            PartitionSpec.unpartitioned(),
   +            ImmutableMap.<String, String>builder()
   +                .put(TableProperties.FORMAT_VERSION, 
String.valueOf(formatVersion))
   +                .putAll(properties)
   +                .build(),
   +            location);
   ```
   
   That way all of the places will automatically configure the format version 
and you don't have to pass `properties()` everywhere



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