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 18:07:07 UTC

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

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

 ##########
 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:
   Modifying `TsvInputFormat` to support a custom delimiter is awkward, since "TSV" implies that the delimiter is a tab. How about using an approach similar to `DelimitedParser` and `AbstractFlatTextFormatParser` instead? For example, the current implementation here is introducing regressions not present in `DelimitedParser` (e.g., `delimeter` and `listDelimeter` should be checked to not have the same value).

----------------------------------------------------------------
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