@@ -96,7 +96,7 @@ public static void main(String [] args) throws Exception {
96
96
RestructureAvroRecords restr = new RestructureAvroRecords .Builder (commandLineArgs .hdfsUri ,
97
97
commandLineArgs .outputDirectory )
98
98
.useGzip ("gzip" .equalsIgnoreCase (commandLineArgs .compression ))
99
- .doDeuplicate (commandLineArgs .deduplicate ).format (commandLineArgs .format )
99
+ .doDeduplicate (commandLineArgs .deduplicate ).format (commandLineArgs .format )
100
100
.build ();
101
101
102
102
try {
@@ -113,16 +113,16 @@ public static void main(String [] args) throws Exception {
113
113
logger .info ("Time taken: {} seconds" , (System .currentTimeMillis () - time1 )/1000d );
114
114
}
115
115
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 );
119
119
120
- this .useGzip = gzip ;
121
- this .doDeduplicate = dedup ;
120
+ this .useGzip = builder . useGzip ;
121
+ this .doDeduplicate = builder . doDeduplicate ;
122
122
logger .info ("Deduplicate set to {}" , doDeduplicate );
123
123
124
124
String extension ;
125
- if (format .equalsIgnoreCase ("json" )) {
125
+ if (builder . format .equalsIgnoreCase ("json" )) {
126
126
logger .info ("Writing output files in JSON format" );
127
127
converterFactory = JsonAvroConverter .getFactory ();
128
128
extension = "json" ;
@@ -383,7 +383,7 @@ public Builder useGzip(final boolean gzip) {
383
383
return this ;
384
384
}
385
385
386
- public Builder doDeuplicate (final boolean dedup ) {
386
+ public Builder doDeduplicate (final boolean dedup ) {
387
387
this .doDeduplicate = dedup ;
388
388
return this ;
389
389
}
@@ -394,7 +394,7 @@ public Builder format(final String format) {
394
394
}
395
395
396
396
public RestructureAvroRecords build () {
397
- return new RestructureAvroRecords (hdfsUri , outputPath , useGzip , doDeduplicate , format );
397
+ return new RestructureAvroRecords (this );
398
398
}
399
399
400
400
}
0 commit comments