Skip to content

Commit c1e8fe4

Browse files
committed
Configure additional HDFS properties
1 parent 3aea2e1 commit c1e8fe4

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ public static void main(String [] args) {
103103

104104
long time1 = System.currentTimeMillis();
105105

106-
RestructureAvroRecords restr = new RestructureAvroRecords
106+
RestructureAvroRecords.Builder builder = new RestructureAvroRecords
107107
.Builder(commandLineArgs.hdfsUri, commandLineArgs.outputDirectory)
108108
.useGzip("gzip".equalsIgnoreCase(commandLineArgs.compression))
109109
.doDeduplicate(commandLineArgs.deduplicate).format(commandLineArgs.format)
110-
.doStage(!commandLineArgs.noStage)
111-
.build();
110+
.doStage(!commandLineArgs.noStage);
111+
112+
RestructureAvroRecords restr = builder.build();
112113

113114
try {
114115
for(String input : commandLineArgs.inputPaths) {
@@ -128,6 +129,10 @@ private RestructureAvroRecords(RestructureAvroRecords.Builder builder) {
128129
this.setInputWebHdfsURL(builder.hdfsUri);
129130
this.setOutputPath(builder.outputPath);
130131

132+
for (Map.Entry<String, String> hdfsConf : builder.hdfsConf.entrySet()) {
133+
conf.set(hdfsConf.getKey(), hdfsConf.getValue());
134+
}
135+
131136
this.useGzip = builder.useGzip;
132137
this.doDeduplicate = builder.doDeduplicate;
133138
this.doStage = builder.doStage;
@@ -386,6 +391,7 @@ public static class Builder {
386391
private boolean useGzip;
387392
private boolean doDeduplicate;
388393
private String hdfsUri;
394+
private Map<String, String> hdfsConf = new HashMap<>();
389395
private String outputPath;
390396
private String format;
391397
private boolean doStage;
@@ -410,6 +416,10 @@ public Builder format(final String format) {
410416
return this;
411417
}
412418

419+
public void putHdfsConfig(String name, String value) {
420+
hdfsConf.put(name, value);
421+
}
422+
413423
public RestructureAvroRecords build() {
414424
return new RestructureAvroRecords(this);
415425
}

0 commit comments

Comments
 (0)