Skip to content

Commit f33c622

Browse files
Minor changes
1 parent 217f926 commit f33c622

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/org/radarcns/RestructureAvroRecords.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static void main(String [] args) throws Exception {
9696
RestructureAvroRecords restr = new RestructureAvroRecords.Builder(commandLineArgs.hdfsUri,
9797
commandLineArgs.outputDirectory)
9898
.useGzip("gzip".equalsIgnoreCase(commandLineArgs.compression))
99-
.doDeuplicate(commandLineArgs.deduplicate).format(commandLineArgs.format)
99+
.doDeduplicate(commandLineArgs.deduplicate).format(commandLineArgs.format)
100100
.build();
101101

102102
try {
@@ -113,16 +113,16 @@ public static void main(String [] args) throws Exception {
113113
logger.info("Time taken: {} seconds", (System.currentTimeMillis() - time1)/1000d);
114114
}
115115

116-
private RestructureAvroRecords(String hdfsUri, String outputPath, boolean gzip, boolean dedup, String format) {
117-
this.setInputWebHdfsURL(hdfsUri);
118-
this.setOutputPath(outputPath);
116+
private RestructureAvroRecords(RestructureAvroRecords.Builder builder) {
117+
this.setInputWebHdfsURL(builder.hdfsUri);
118+
this.setOutputPath(builder.outputPath);
119119

120-
this.useGzip = gzip;
121-
this.doDeduplicate = dedup;
120+
this.useGzip = builder.useGzip;
121+
this.doDeduplicate = builder.doDeduplicate;
122122
logger.info("Deduplicate set to {}", doDeduplicate);
123123

124124
String extension;
125-
if (format.equalsIgnoreCase("json")) {
125+
if (builder.format.equalsIgnoreCase("json")) {
126126
logger.info("Writing output files in JSON format");
127127
converterFactory = JsonAvroConverter.getFactory();
128128
extension = "json";
@@ -383,7 +383,7 @@ public Builder useGzip(final boolean gzip) {
383383
return this;
384384
}
385385

386-
public Builder doDeuplicate(final boolean dedup) {
386+
public Builder doDeduplicate(final boolean dedup) {
387387
this.doDeduplicate = dedup;
388388
return this;
389389
}
@@ -394,7 +394,7 @@ public Builder format(final String format) {
394394
}
395395

396396
public RestructureAvroRecords build() {
397-
return new RestructureAvroRecords(hdfsUri, outputPath, useGzip, doDeduplicate, format);
397+
return new RestructureAvroRecords(this);
398398
}
399399

400400
}

0 commit comments

Comments
 (0)