Skip to content

Commit

Permalink
rework
Browse files Browse the repository at this point in the history
  • Loading branch information
vikasrathee-cs committed May 17, 2024
1 parent 954d559 commit 414c03b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public class TestDelegatingGCSOutputCommitter {
private static TaskAttemptID taskID = TaskAttemptID.forName(attempt);
private static String key1 = "key1";
private static String key2 = "key2";
private String schema = "{\"type\":\"record\",\"name\":\"text\",\"fields\":[{\"name\":\"key1\",\"type\":\"string\"},{\"name\":\"key2\",\"type\":\"string\"}]}";
private String schema = "{\"type\":\"record\",\"name\":\"text\",\"fields\":" +
"[{\"name\":\"key1\",\"type\":\"string\"}," +
"{\"name\":\"key2\",\"type\":\"string\"}]}";
private StructuredRecord record1 = StructuredRecord.builder(Schema.parseJson(schema))
.set(key1, "abc")
.set(key2, "val1")
Expand All @@ -88,6 +90,8 @@ private void writeOutput(TaskAttemptContext context, DelegatingGCSOutputCommitte
try {
delegatingGCSRecordWriter.write(nullWritable, record1);
delegatingGCSRecordWriter.write(nullWritable, record2);
delegatingGCSRecordWriter.write(nullWritable, record2);
delegatingGCSRecordWriter.write(nullWritable, record1);
} finally {
delegatingGCSRecordWriter.close(null);
}
Expand Down Expand Up @@ -145,6 +149,8 @@ private void validateContent(Path dir) throws IOException {
StringBuffer expectedOutput = new StringBuffer();
expectedOutput.append(record1.get(key1).toString()).append('\t').append(record1.get(key2).toString()).append("\n");
expectedOutput.append(record2.get(key1).toString()).append('\t').append(record2.get(key2).toString()).append("\n");
expectedOutput.append(record2.get(key1).toString()).append('\t').append(record2.get(key2).toString()).append("\n");
expectedOutput.append(record1.get(key1).toString()).append('\t').append(record1.get(key2).toString()).append("\n");
String output = slurpAvro(expectedFile);
assertEquals(output, expectedOutput.toString());
}
Expand Down Expand Up @@ -387,7 +393,6 @@ public static String slurpAvro(File f) throws IOException {
*/
public static class CommitterWithFailedThenSucceed extends
DelegatingGCSOutputCommitter {
boolean firstTimeFail = true;

public CommitterWithFailedThenSucceed(TaskAttemptContext context) throws IOException {
super(context);
Expand Down

0 comments on commit 414c03b

Please sign in to comment.