Copilot commented on code in PR #17586:
URL: https://github.com/apache/hudi/pull/17586#discussion_r2615991031
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/util/TestFileIOUtils.java:
##########
@@ -45,36 +46,36 @@ public class TestFileIOUtils extends
HoodieCommonTestHarness {
@Test
public void testMkdirAndDelete() throws IOException {
try {
- FileIOUtils.mkdir(tempDir.toFile());
+ org.apache.hudi.io.util.FileIOUtils.mkdir(tempDir.toFile());
} catch (IOException e) {
fail("Should not error out if dir exists already");
}
File dir = tempDir.resolve("dir").toFile();
- FileIOUtils.mkdir(dir);
+ org.apache.hudi.io.util.FileIOUtils.mkdir(dir);
assertTrue(dir.exists());
new File(dir, "t.txt").createNewFile();
new File(dir, "subdir").mkdirs();
new File(dir, "subdir" + File.pathSeparator + "z.txt").createNewFile();
- FileIOUtils.deleteDirectory(dir);
+ org.apache.hudi.io.util.FileIOUtils.deleteDirectory(dir);
assertFalse(dir.exists());
}
@Test
public void testInputStreamReads() throws IOException {
String msg = "hudi rocks!";
ByteArrayInputStream inputStream = new
ByteArrayInputStream(getUTF8Bytes(msg));
- assertEquals(msg, FileIOUtils.readAsUTFString(inputStream));
+ assertEquals(msg,
org.apache.hudi.io.util.FileIOUtils.readAsUTFString(inputStream));
inputStream = new ByteArrayInputStream(getUTF8Bytes(msg));
- assertEquals(msg.length(),
FileIOUtils.readAsByteArray(inputStream).length);
+ assertEquals(msg.length(),
org.apache.hudi.io.util.FileIOUtils.readAsByteArray(inputStream).length);
}
@Test
public void testReadAsUTFStringLines() {
String content = "a\nb\nc";
List<String> expectedLines = Arrays.stream(new String[] {"a", "b",
"c"}).collect(Collectors.toList());
ByteArrayInputStream inputStream = new
ByteArrayInputStream(getUTF8Bytes(content));
- assertEquals(expectedLines, FileIOUtils.readAsUTFStringLines(inputStream));
+ assertEquals(expectedLines,
org.apache.hudi.io.util.FileIOUtils.readAsUTFStringLines(inputStream));
Review Comment:
The method call uses a fully qualified name
`org.apache.hudi.io.util.FileIOUtils` even though FileIOUtils is already
imported at line 22. For better code readability, the fully qualified name
should be replaced with the simple class name `FileIOUtils` to be consistent
with the import statement.
##########
hudi-common/src/test/java/org/apache/hudi/common/util/io/TestByteBufferBackedInputStream.java:
##########
@@ -78,7 +80,7 @@ public void testRead() {
public void testSeek() {
byte[] sourceBytes = { 0xD, 0xE, 0xA, 0xD, 0xD, 0xA, 0xE, 0xD };
- ByteBufferBackedInputStream stream = new
ByteBufferBackedInputStream(sourceBytes, 1, 7);
+ org.apache.hudi.io.ByteBufferBackedInputStream stream = new
org.apache.hudi.io.ByteBufferBackedInputStream(sourceBytes, 1, 7);
Review Comment:
The constructor call uses a fully qualified name
`org.apache.hudi.io.ByteBufferBackedInputStream` even though
ByteBufferBackedInputStream is already imported at line 21. For better code
readability, the fully qualified name should be replaced with the simple class
name `ByteBufferBackedInputStream` to be consistent with the import statement.
##########
hudi-common/src/test/java/org/apache/hudi/common/util/io/TestByteBufferBackedInputStream.java:
##########
@@ -61,7 +63,7 @@ public void testConstructor() {
public void testRead() {
byte[] sourceBytes = { 0xD, 0xE, 0xA, 0xD, 0xD, 0xE, 0xE, 0xD };
- ByteBufferBackedInputStream stream = new
ByteBufferBackedInputStream(sourceBytes);
+ org.apache.hudi.io.ByteBufferBackedInputStream stream = new
org.apache.hudi.io.ByteBufferBackedInputStream(sourceBytes);
Review Comment:
The constructor call uses a fully qualified name
`org.apache.hudi.io.ByteBufferBackedInputStream` even though
ByteBufferBackedInputStream is already imported at line 21. For better code
readability, the fully qualified name should be replaced with the simple class
name `ByteBufferBackedInputStream` to be consistent with the import statement.
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/util/TestFileIOUtils.java:
##########
@@ -90,10 +91,10 @@ public void testGetConfiguredLocalDirs() {
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new IllegalArgumentException(e);
}
- assertEquals(String.join("", FileIOUtils.getConfiguredLocalDirs()),
+ assertEquals(String.join("",
org.apache.hudi.io.util.FileIOUtils.getConfiguredLocalDirs()),
System.getProperty("java.io.tmpdir"));
envMaps.put("LOCAL_DIRS", "/xxx");
- assertEquals(String.join("", FileIOUtils.getConfiguredLocalDirs()),
+ assertEquals(String.join("",
org.apache.hudi.io.util.FileIOUtils.getConfiguredLocalDirs()),
envMaps.get("LOCAL_DIRS"));
}
Review Comment:
The method calls in this test use fully qualified names
`org.apache.hudi.io.util.FileIOUtils` even though FileIOUtils is already
imported at line 22. For better code readability, the fully qualified names
should be replaced with the simple class name `FileIOUtils` to be consistent
with the import statement.
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/util/TestFileIOUtils.java:
##########
@@ -104,7 +105,7 @@ public void testGetDefaultSpillableMapBasePath() {
// Case when local dirs provided
System.setProperty("java.io.tmpdir", "dir1,dir2,dir3");
- String result = FileIOUtils.getDefaultSpillableMapBasePath();
+ String result =
org.apache.hudi.io.util.FileIOUtils.getDefaultSpillableMapBasePath();
Review Comment:
The method call uses a fully qualified name
`org.apache.hudi.io.util.FileIOUtils` even though FileIOUtils is already
imported at line 22. For better code readability, the fully qualified name
should be replaced with the simple class name `FileIOUtils` to be consistent
with the import statement.
##########
hudi-common/src/main/java/org/apache/hudi/common/util/MarkerUtils.java:
##########
@@ -119,7 +120,7 @@ public static Option<MarkerType>
readMarkerType(HoodieStorage storage, String ma
return Option.empty();
}
inputStream = storage.open(markerTypeFilePath);
- String markerType = FileIOUtils.readAsUTFString(inputStream);
+ String markerType =
org.apache.hudi.io.util.FileIOUtils.readAsUTFString(inputStream);
Review Comment:
Inconsistent usage of FileIOUtils reference. Line 123 uses the fully
qualified name `org.apache.hudi.io.util.FileIOUtils.readAsUTFString()` while
FileIOUtils is already imported at line 30 (via static import of closeQuietly
at line 56). This should use the simple class name
`FileIOUtils.readAsUTFString()` for consistency.
```suggestion
String markerType = FileIOUtils.readAsUTFString(inputStream);
```
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/util/TestFileIOUtils.java:
##########
@@ -45,36 +46,36 @@ public class TestFileIOUtils extends
HoodieCommonTestHarness {
@Test
public void testMkdirAndDelete() throws IOException {
try {
- FileIOUtils.mkdir(tempDir.toFile());
+ org.apache.hudi.io.util.FileIOUtils.mkdir(tempDir.toFile());
} catch (IOException e) {
fail("Should not error out if dir exists already");
}
File dir = tempDir.resolve("dir").toFile();
- FileIOUtils.mkdir(dir);
+ org.apache.hudi.io.util.FileIOUtils.mkdir(dir);
assertTrue(dir.exists());
new File(dir, "t.txt").createNewFile();
new File(dir, "subdir").mkdirs();
new File(dir, "subdir" + File.pathSeparator + "z.txt").createNewFile();
- FileIOUtils.deleteDirectory(dir);
+ org.apache.hudi.io.util.FileIOUtils.deleteDirectory(dir);
assertFalse(dir.exists());
}
Review Comment:
The method calls in this test use fully qualified names
`org.apache.hudi.io.util.FileIOUtils` even though FileIOUtils is already
imported at line 22. For better code readability, the fully qualified names
should be replaced with the simple class name `FileIOUtils` to be consistent
with the import statement.
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/util/TestFileIOUtils.java:
##########
@@ -45,36 +46,36 @@ public class TestFileIOUtils extends
HoodieCommonTestHarness {
@Test
public void testMkdirAndDelete() throws IOException {
try {
- FileIOUtils.mkdir(tempDir.toFile());
+ org.apache.hudi.io.util.FileIOUtils.mkdir(tempDir.toFile());
} catch (IOException e) {
fail("Should not error out if dir exists already");
}
File dir = tempDir.resolve("dir").toFile();
- FileIOUtils.mkdir(dir);
+ org.apache.hudi.io.util.FileIOUtils.mkdir(dir);
assertTrue(dir.exists());
new File(dir, "t.txt").createNewFile();
new File(dir, "subdir").mkdirs();
new File(dir, "subdir" + File.pathSeparator + "z.txt").createNewFile();
- FileIOUtils.deleteDirectory(dir);
+ org.apache.hudi.io.util.FileIOUtils.deleteDirectory(dir);
assertFalse(dir.exists());
}
@Test
public void testInputStreamReads() throws IOException {
String msg = "hudi rocks!";
ByteArrayInputStream inputStream = new
ByteArrayInputStream(getUTF8Bytes(msg));
- assertEquals(msg, FileIOUtils.readAsUTFString(inputStream));
+ assertEquals(msg,
org.apache.hudi.io.util.FileIOUtils.readAsUTFString(inputStream));
inputStream = new ByteArrayInputStream(getUTF8Bytes(msg));
- assertEquals(msg.length(),
FileIOUtils.readAsByteArray(inputStream).length);
+ assertEquals(msg.length(),
org.apache.hudi.io.util.FileIOUtils.readAsByteArray(inputStream).length);
}
@Test
Review Comment:
The method calls in this test use fully qualified names
`org.apache.hudi.io.util.FileIOUtils` even though FileIOUtils is already
imported at line 22. For better code readability, the fully qualified names
should be replaced with the simple class name `FileIOUtils` to be consistent
with the import statement.
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/util/ParquetReaderIterator.java:
##########
@@ -50,7 +51,7 @@ public boolean hasNext() {
}
return this.next != null;
} catch (Exception e) {
- FileIOUtils.closeQuietly(parquetReader);
+ org.apache.hudi.io.util.FileIOUtils.closeQuietly(parquetReader);
Review Comment:
Inconsistent usage of FileIOUtils reference. Line 54 uses the fully
qualified name `org.apache.hudi.io.util.FileIOUtils.closeQuietly()` while
FileIOUtils is already imported at line 24. This should use the simple class
name `FileIOUtils.closeQuietly()` for consistency, matching the usage on line
72.
--
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]