cgivre commented on a change in pull request #2485:
URL: https://github.com/apache/drill/pull/2485#discussion_r826962029



##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/TextFormatConfig.java
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.store.easy.text;
+
+import java.util.List;
+import java.util.Objects;
+
+import org.apache.drill.common.PlanStringBuilder;
+import org.apache.drill.common.logical.FormatPluginConfig;
+import org.apache.drill.shaded.guava.com.google.common.base.Strings;
+import org.apache.drill.shaded.guava.com.google.common.collect.ImmutableList;
+
+import com.fasterxml.jackson.annotation.JsonAlias;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonTypeName(TextFormatPlugin.PLUGIN_NAME)
+@JsonInclude(Include.NON_DEFAULT)
+public class TextFormatConfig implements FormatPluginConfig {
+
+  public final List<String> extensions;
+  public final String lineDelimiter;
+  public final char fieldDelimiter;
+  public final char quote;
+  public final char escape;
+  public final char comment;
+  public final boolean skipFirstLine;
+  public final boolean extractHeader;
+
+  @JsonCreator
+  public TextFormatConfig(
+      @JsonProperty("extensions") List<String> extensions,
+      @JsonProperty("lineDelimiter") String lineDelimiter,
+      // Drill 1.17 and before used "delimiter" in the
+      // bootstrap storage plugins file, assume many instances
+      // exist in the field.
+      @JsonAlias("delimiter")
+      @JsonProperty("fieldDelimiter") String fieldDelimiter,
+      @JsonProperty("quote") String quote,
+      @JsonProperty("escape") String escape,
+      @JsonProperty("comment") String comment,
+      @JsonProperty("skipFirstLine") Boolean skipFirstLine,
+      @JsonProperty("extractHeader") Boolean extractHeader) {
+    this.extensions = extensions == null ?
+        ImmutableList.of() : ImmutableList.copyOf(extensions);
+    this.lineDelimiter = lineDelimiter == null ? "\n" : lineDelimiter;
+    this.fieldDelimiter = Strings.isNullOrEmpty(fieldDelimiter) ? ',' : 
fieldDelimiter.charAt(0);
+    this.quote = Strings.isNullOrEmpty(quote) ? '"' : quote.charAt(0);
+    this.escape = Strings.isNullOrEmpty(escape) ? '"' : escape.charAt(0);
+    this.comment = Strings.isNullOrEmpty(comment) ? '#' : comment.charAt(0);
+    this.skipFirstLine = skipFirstLine == null ? false : skipFirstLine;
+    this.extractHeader = extractHeader == null ? false : extractHeader;
+  }
+
+  public TextFormatConfig() {

Review comment:
       What is the purpose of this constructor?   If this is some default 
constructor, should there be some common default values?




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

To unsubscribe, e-mail: dev-unsubscr...@drill.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to