arina-ielchiieva commented on a change in pull request #1873: DRILL-6096:
Provide mechanism to configure text writer configuration
URL: https://github.com/apache/drill/pull/1873#discussion_r335092299
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/writer/TextRecordWriter.java
##########
@@ -93,29 +112,35 @@ public void startNewSchema(List<String> columnNames)
throws IOException {
// we need to re-apply file permission
DataOutputStream fos = fs.create(fileName);
storageStrategy.applyToFile(fs, fileName);
+ logger.debug("Created file: {}.", fileName);
+
+ this.writer = new CsvWriter(fos, writerSettings);
- stream = new PrintStream(fos);
- logger.debug("Created file: {}", fileName);
- } catch (IOException ex) {
- logger.error("Unable to create file: " + fileName, ex);
- throw ex;
+ } catch (IOException e) {
+ throw new IOException(String.format("Unable to create file: %s.",
fileName), e);
}
- index++;
- stream.println(Joiner.on(fieldDelimiter).join(columnNames));
+ fileNumberIndex++;
+
+ if (writerSettings.isHeaderWritingEnabled()) {
+ writer.writeHeaders(
+ IntStream.range(0, schema.getFieldCount())
Review comment:
Good point, thanks for noticing. Fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services