Copilot commented on code in PR #8585:
URL: https://github.com/apache/hadoop/pull/8585#discussion_r3597412987
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestTextCommand.java:
##########
@@ -513,22 +514,20 @@ private static byte[] generateEmptyAvroBinaryData() {
private static void createEmptySequenceFile(String fileName, Configuration
conf)
throws IOException {
- conf.set("io.serializations",
"org.apache.hadoop.io.serializer.JavaSerialization");
Path path = new Path(fileName);
SequenceFile.Writer writer = SequenceFile.createWriter(conf,
SequenceFile.Writer.file(path),
- SequenceFile.Writer.keyClass(String.class),
SequenceFile.Writer.valueClass(String.class));
+ SequenceFile.Writer.keyClass(Text.class),
SequenceFile.Writer.valueClass(Text.class));
writer.close();
}
private static void createNonWritableSequenceFile(String fileName,
Configuration conf)
throws IOException {
- conf.set("io.serializations",
"org.apache.hadoop.io.serializer.JavaSerialization");
Path path = new Path(fileName);
try (SequenceFile.Writer writer = SequenceFile.createWriter(conf,
- SequenceFile.Writer.file(path),
SequenceFile.Writer.keyClass(String.class),
- SequenceFile.Writer.valueClass(String.class))) {
- writer.append("Key1", "Value1");
- writer.append("Key2", "Value2");
+ SequenceFile.Writer.file(path),
SequenceFile.Writer.keyClass(Text.class),
+ SequenceFile.Writer.valueClass(Text.class))) {
+ writer.append(new Text("Key1"), new Text("Value1"));
+ writer.append(new Text("Key2"), new Text("Value2"));
}
Review Comment:
`createNonWritableSequenceFile` now writes `Text` keys/values (i.e.,
Writable types), so it no longer creates a “non-writable” SequenceFile as the
helper name, `SEQUENCE_FILENAME` ("NonWritableSequenceFile"), and related test
names imply. This makes the tests misleading and likely drops coverage for the
original non-Writable SequenceFile path.
Consider either (a) renaming the helper/test/file constants to reflect that
this is a normal Writable SequenceFile, or (b) reworking the helper to actually
generate a SequenceFile whose key/value types are not Writable (using an
alternative supported serialization).
--
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]