Skip to content

Commit 4ce3e48

Browse files
aebadiradMarkLogic Builder
authored andcommitted
DHFPROD-2592: cleanup of if conditional, consolidation of member vars
1 parent d659dbc commit 4ce3e48

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/step/impl/WriteStepRunner.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public class WriteStepRunner implements StepRunner {
8888
private String outputFormat;
8989
private String inputFileType;
9090
private String outputURIReplacement;
91-
private String separator;
92-
private char csvColumnSeparator = ',';
91+
private String separator = ",";
9392
private AtomicBoolean isStopped = new AtomicBoolean(false);
9493
private IngestionStepDefinitionImpl stepDef;
9594
private Map<String, Object> stepConfig = new HashMap<>();
@@ -283,22 +282,11 @@ public RunStepResponse run() {
283282
inputFilePath = (String)fileLocation.get("inputFilePath");
284283
inputFileType = (String)fileLocation.get("inputFileType");
285284
outputURIReplacement = (String)fileLocation.get("outputURIReplacement");
286-
we do not need a member variable "csvColumnSeparator", instead
287-
private char csvColumnSeparator = ','; => private static final CSV_DEFAULT_COLUMN_SEPARATOR = ',';
288-
separator = Character.toString(CSV_DEFAULT_COLUMN_SEPARATOR);
289-
if (inputFileType.equalsIgnoreCase("csv") && fileLocation.get("separator") != null) {
290-
String tmp =((String) fileLocation.get("separator")).trim();
291-
if (tmp.equals("\\t") {
292-
separator = "\t";
293-
}
294-
}
295-
296-
changed line 627 => .withColumnSeparator(separator.charAt(0));
285+
if(inputFileType.equalsIgnoreCase("csv") && fileLocation.get("separator") != null) {
297286
separator =((String) fileLocation.get("separator")).trim();
298287
if (separator.equals("\\t")) {
299288
separator = "\t";
300289
}
301-
csvColumnSeparator = separator != null ? separator.charAt(0) : ',';
302290
}
303291

304292
if(stepConfig.get("batchSize") != null){
@@ -634,7 +622,7 @@ private void addToBatcher(File file, Format fileFormat) throws IOException{
634622
if(inputFileType.equalsIgnoreCase("csv") || inputFileType.equalsIgnoreCase("tsv") || inputFileType.equalsIgnoreCase("psv")) {
635623
CsvSchema schema = CsvSchema.emptySchema()
636624
.withHeader()
637-
.withColumnSeparator(csvColumnSeparator);
625+
.withColumnSeparator(separator.charAt(0));
638626
JacksonCSVSplitter splitter = new JacksonCSVSplitter().withCsvSchema(schema);
639627
try {
640628
if(! writeBatcher.isStopped()) {

0 commit comments

Comments
 (0)