You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/12/05 20:07:29 UTC

[GitHub] [incubator-druid] SEKIRO-J commented on a change in pull request #8993: add customize separator for TSV inputFormat

SEKIRO-J commented on a change in pull request #8993: add customize separator for TSV inputFormat
URL: https://github.com/apache/incubator-druid/pull/8993#discussion_r354522429
 
 

 ##########
 File path: core/src/main/java/org/apache/druid/data/input/impl/TsvInputFormat.java
 ##########
 @@ -27,15 +27,34 @@
 
 public class TsvInputFormat extends SeparateValueInputFormat
 {
+
+  private static Format getFormat(String delimiter)
+  {
+    if (delimiter != null && delimiter.length() > 0) {
+      Format.CustomizeSV.setDelimiter(delimiter, null);
+      return Format.CustomizeSV;
+    } else {
+      return Format.TSV;
+    }
+  }
+
   @JsonCreator
   public TsvInputFormat(
       @JsonProperty("columns") @Nullable List<String> columns,
       @JsonProperty("listDelimiter") @Nullable String listDelimiter,
+      @JsonProperty("delimiter") @Nullable String delimiter,
 
 Review comment:
   https://druid.apache.org/docs/latest/ingestion/data-formats.html#tsv-delimited-parsespec, However in this documentation, `format: tsv` implies user could use any delimiter, and default is tab.
   How about this design: rename `SeparateValueInputFormat` to `DelimitedInputFormat`,  when user say `tsv`, instantiate a `DelimitedInputFormat` object, when user say `csv`, instantiate `CSVInputFormat` which extends `DelimitedInputFormat`  

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org