Skip to content

Commit

Permalink
Update RealizedRelationalResultCSVSerializer.java
Browse files Browse the repository at this point in the history
  • Loading branch information
PrateekGarg-gs authored Oct 6, 2023
1 parent 90f16d4 commit af2094f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class RealizedRelationalResultCSVSerializer extends CsvSerializer
private String databaseTimeZone;
private boolean withHeader;
private boolean withTransform;
private boolean normalizeWithTimeZone;
private CSVFormat csvFormat;

public RealizedRelationalResultCSVSerializer(RealizedRelationalResult realizedRelationalResult, String databaseTimeZone)
Expand All @@ -52,12 +53,18 @@ public RealizedRelationalResultCSVSerializer(RealizedRelationalResult realizedRe
}

public RealizedRelationalResultCSVSerializer(RealizedRelationalResult realizedRelationalResult, String databaseTimeZone, boolean withHeader, boolean withTransform, CSVFormat csvFormat)
{
this(realizedRelationalResult, databaseTimeZone, withHeader, withTransform, csvFormat, true);
}

public RealizedRelationalResultCSVSerializer(RealizedRelationalResult realizedRelationalResult, String databaseTimeZone, boolean withHeader, boolean withTransform, CSVFormat csvFormat, Boolean normalizeWithTimeZone)
{
this.realizedRelationalResult = realizedRelationalResult;
this.withHeader = withHeader;
this.withTransform = withTransform;
this.databaseTimeZone = databaseTimeZone;
this.csvFormat = csvFormat;
this.normalizeWithTimeZone = normalizeWithTimeZone;
}

@Override
Expand All @@ -84,7 +91,7 @@ public void stream(OutputStream targetStream)
}
for (List<Object> row : rows)
{
List<Object> normalizedRow = row.stream().map(x -> x != null ? ResultNormalizer.normalizeToSql(x, this.databaseTimeZone) : null).collect(Collectors.toList());
List<Object> normalizedRow = row.stream().map(x -> x != null ? ResultNormalizer.normalizeToSql(x, this.databaseTimeZone, this.normalizeWithTimeZone) : null).collect(Collectors.toList());
csvPrinter.printRecord(normalizedRow);
}

Expand Down

0 comments on commit af2094f

Please sign in to comment.