RussellSpitzer commented on a change in pull request #3733:
URL: https://github.com/apache/iceberg/pull/3733#discussion_r769097750
##########
File path: core/src/test/java/org/apache/iceberg/TestTables.java
##########
@@ -80,21 +81,26 @@ public static Transaction beginCreate(File temp, String
name, Schema schema,
}
public static Transaction beginReplace(File temp, String name, Schema
schema, PartitionSpec spec) {
- return beginReplace(temp, name, schema, spec, SortOrder.unsorted(),
ImmutableMap.of());
+ return beginReplace(temp, name, schema, spec, SortOrder.unsorted(),
ImmutableMap.of(), null);
}
public static Transaction beginReplace(File temp, String name, Schema
schema, PartitionSpec spec,
- SortOrder sortOrder, Map<String,
String> properties) {
- TestTableOperations ops = new TestTableOperations(name, temp);
- TableMetadata current = ops.current();
+ SortOrder sortOrder, Map<String, String> properties) {
+ return beginReplace(temp, name, schema, spec, sortOrder, properties, null);
+ }
+
+ public static Transaction beginReplace(File temp, String name, Schema
schema, PartitionSpec spec,
+ SortOrder sortOrder, Map<String,
String> properties, TestTableOperations ops) {
+ TestTableOperations finalOps = ops != null ? ops : new
TestTableOperations(name, temp);
Review comment:
Instead of the null check here, you can pass the new
TestTableOperations() in the previous method.
```java
return beginReplace(temp, name, schema, spec, sortOrder, properties, new
TestTableOperations(name, temp));
```
I tend to like that better because then the caller method knows exactly what
value will be used there instead of having to check the implementation for the
special null casing. If this was a production method I would put a precondition
(ops not null) but I'm not sure that's important here since we know all the
callers.
--
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]