lisirrx commented on code in PR #9711:
URL: https://github.com/apache/iceberg/pull/9711#discussion_r1487359273


##########
mr/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java:
##########
@@ -90,52 +93,49 @@ public class TestIcebergInputFormats {
   private static final PartitionSpec SPEC =
       PartitionSpec.builderFor(SCHEMA).identity("date").bucket("id", 
1).build();
 
-  @Rule public TemporaryFolder temp = new TemporaryFolder();
+  @TempDir public Path temp;
 
   // before variables
   private Configuration conf;
   private TestHelper helper;
   private InputFormatConfig.ConfigBuilder builder;
 
   // parametrized variables
-  private final TestInputFormat.Factory<Record> testInputFormat;
-  private final FileFormat fileFormat;
+  @Parameter(index = 0)
+  private TestInputFormat.Factory<Record> testInputFormat;
+
+  @Parameter(index = 1)
+  private FileFormat fileFormat;
 
-  @Before
+  @BeforeEach
   public void before() throws IOException {
     conf = new Configuration();
     conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
     HadoopTables tables = new HadoopTables(conf);
 
-    File location = temp.newFolder(testInputFormat.name(), fileFormat.name());
-    Assert.assertTrue(location.delete());
+    File location = temp.resolve(Paths.get(testInputFormat.name(), 
fileFormat.name())).toFile();

Review Comment:
   In other places, the  `Files.createTempDirectory(temp, "junit").toFile()` is 
used to replace `temp.newFolder();` which create a `junit` folder under the 
`temp`'s root path.
   However, when comes `temp.newFolder(path1, path2)`, the method create a new 
leveled path like `${tempRoot}/path1/path2`. I read the source code of 
`Files.createTempDirectory` and it can only create one level path. So I use 
`temp.resolve` here



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to