You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/04/22 09:26:11 UTC

[GitHub] [incubator-inlong] gong opened a new pull request, #3886: [INLONG-3884][Sort]Add csv format for ExtractNode and LoadNode and op…

gong opened a new pull request, #3886:
URL: https://github.com/apache/incubator-inlong/pull/3886

   ### [INLONG-3884][Sort]Add csv format for ExtractNode and LoadNode and optimize fill options of table
   
   Fixes #3884 
   
   ### Motivation
   
   It will support csv format
   
   ### Modifications
   
   Add csv format class.
   Optimize fill options of table
   
   *Describe the modifications you've done.*
   


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [incubator-inlong] EMsnap commented on a diff in pull request #3886: [INLONG-3884][Sort]Add csv format for ExtractNode and LoadNode

Posted by GitBox <gi...@apache.org>.
EMsnap commented on code in PR #3886:
URL: https://github.com/apache/incubator-inlong/pull/3886#discussion_r856126940


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/CsvFormat.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.inlong.sort.protocol.node.format;
+
+import lombok.Data;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The CSV format.
+ *
+ * @see <a href="https://nightlies.apache.org/flink/flink-docs-release-1.13/zh/docs/connectors/table/formats/csv/">CSV
+ *         Format</a>
+ */
+@JsonTypeName("csvFormat")
+@Data
+public class CsvFormat implements Format {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonProperty(value = "fieldDelimiter", defaultValue = ",")
+    private String fieldDelimiter;
+    @JsonProperty(value = "disableQuoteCharacter", defaultValue = "false")
+    private Boolean disableQuoteCharacter;
+    @JsonProperty(value = "quoteCharacter", defaultValue = "\"")
+    private String quoteCharacter;
+    @JsonProperty(value = "allowComments", defaultValue = "false")
+    private Boolean allowComments;
+    @JsonProperty(value = "ignoreParseErrors", defaultValue = "false")
+    private Boolean ignoreParseErrors;
+    @JsonProperty(value = "arrayElementDelimiter", defaultValue = ";")
+    private String arrayElementDelimiter;
+    @JsonProperty(value = "escapeCharacter")
+    private String escapeCharacter;
+    @JsonProperty(value = "nullLiteral")
+    private String nullLiteral;
+
+    @JsonCreator
+    public CsvFormat(@JsonProperty(value = "fieldDelimiter", defaultValue = ",") String fieldDelimiter,
+            @JsonProperty(value = "disableQuoteCharacter", defaultValue = "false") Boolean disableQuoteCharacter,
+            @JsonProperty(value = "quoteCharacter", defaultValue = "\"") String quoteCharacter,
+            @JsonProperty(value = "allowComments", defaultValue = "false") Boolean allowComments,
+            @JsonProperty(value = "ignoreParseErrors", defaultValue = "false") Boolean ignoreParseErrors,
+            @JsonProperty(value = "arrayElementDelimiter", defaultValue = ";") String arrayElementDelimiter,
+            @JsonProperty(value = "escapeCharacter") String escapeCharacter,
+            @JsonProperty(value = "nullLiteral") String nullLiteral) {
+        this.fieldDelimiter = fieldDelimiter;
+        this.disableQuoteCharacter = disableQuoteCharacter;
+        this.quoteCharacter = quoteCharacter;
+        this.allowComments = allowComments;
+        this.ignoreParseErrors = ignoreParseErrors;
+        this.arrayElementDelimiter = arrayElementDelimiter;
+        this.escapeCharacter = escapeCharacter;
+        this.nullLiteral = nullLiteral;
+    }
+
+    @JsonCreator
+    public CsvFormat() {
+        this(",", false, "\"", false, false, ";", null, null);
+    }
+
+    @JsonIgnore
+    @Override
+    public String getFormat() {
+        return "csv";
+    }
+
+    /**
+     * Generate options for connector
+     * @param includePrefix true will need append key and value when format is json avro csv
+     * @return options
+     */
+    @Override
+    public Map<String, String> generateOptions(boolean includePrefix) {

Review Comment:
   method is too long



##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/JsonFormat.java:
##########
@@ -88,35 +88,54 @@ public String getFormat() {
 
     /**
      * Generate options for connector
-     *
+     * @param includePrefix true will need append key and value when format is json avro csv
      * @return options
      */
     @Override
-    public Map<String, String> generateOptions() {
+    public Map<String, String> generateOptions(boolean includePrefix) {

Review Comment:
   method is too long



##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/JsonFormat.java:
##########
@@ -88,35 +88,54 @@ public String getFormat() {
 
     /**
      * Generate options for connector
-     *
+     * @param includePrefix true will need append key and value when format is json avro csv
      * @return options
      */
     @Override
-    public Map<String, String> generateOptions() {
+    public Map<String, String> generateOptions(boolean includePrefix) {

Review Comment:
   method is too long



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [incubator-inlong] gong commented on a diff in pull request #3886: [INLONG-3884][Sort]Add csv format for ExtractNode and LoadNode

Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #3886:
URL: https://github.com/apache/incubator-inlong/pull/3886#discussion_r856237796


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/JsonFormat.java:
##########
@@ -88,35 +88,54 @@ public String getFormat() {
 
     /**
      * Generate options for connector
-     *
+     * @param includePrefix true will need append key and value when format is json avro csv
      * @return options
      */
     @Override
-    public Map<String, String> generateOptions() {
+    public Map<String, String> generateOptions(boolean includePrefix) {

Review Comment:
   ok



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [incubator-inlong] gong commented on a diff in pull request #3886: [INLONG-3884][Sort]Add csv format for ExtractNode and LoadNode

Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #3886:
URL: https://github.com/apache/incubator-inlong/pull/3886#discussion_r856238175


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/CsvFormat.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.inlong.sort.protocol.node.format;
+
+import lombok.Data;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The CSV format.
+ *
+ * @see <a href="https://nightlies.apache.org/flink/flink-docs-release-1.13/zh/docs/connectors/table/formats/csv/">CSV
+ *         Format</a>
+ */
+@JsonTypeName("csvFormat")
+@Data
+public class CsvFormat implements Format {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonProperty(value = "fieldDelimiter", defaultValue = ",")
+    private String fieldDelimiter;
+    @JsonProperty(value = "disableQuoteCharacter", defaultValue = "false")
+    private Boolean disableQuoteCharacter;
+    @JsonProperty(value = "quoteCharacter", defaultValue = "\"")
+    private String quoteCharacter;
+    @JsonProperty(value = "allowComments", defaultValue = "false")
+    private Boolean allowComments;
+    @JsonProperty(value = "ignoreParseErrors", defaultValue = "false")
+    private Boolean ignoreParseErrors;
+    @JsonProperty(value = "arrayElementDelimiter", defaultValue = ";")
+    private String arrayElementDelimiter;
+    @JsonProperty(value = "escapeCharacter")
+    private String escapeCharacter;
+    @JsonProperty(value = "nullLiteral")
+    private String nullLiteral;
+
+    @JsonCreator
+    public CsvFormat(@JsonProperty(value = "fieldDelimiter", defaultValue = ",") String fieldDelimiter,
+            @JsonProperty(value = "disableQuoteCharacter", defaultValue = "false") Boolean disableQuoteCharacter,
+            @JsonProperty(value = "quoteCharacter", defaultValue = "\"") String quoteCharacter,
+            @JsonProperty(value = "allowComments", defaultValue = "false") Boolean allowComments,
+            @JsonProperty(value = "ignoreParseErrors", defaultValue = "false") Boolean ignoreParseErrors,
+            @JsonProperty(value = "arrayElementDelimiter", defaultValue = ";") String arrayElementDelimiter,
+            @JsonProperty(value = "escapeCharacter") String escapeCharacter,
+            @JsonProperty(value = "nullLiteral") String nullLiteral) {
+        this.fieldDelimiter = fieldDelimiter;
+        this.disableQuoteCharacter = disableQuoteCharacter;
+        this.quoteCharacter = quoteCharacter;
+        this.allowComments = allowComments;
+        this.ignoreParseErrors = ignoreParseErrors;
+        this.arrayElementDelimiter = arrayElementDelimiter;
+        this.escapeCharacter = escapeCharacter;
+        this.nullLiteral = nullLiteral;
+    }
+
+    @JsonCreator
+    public CsvFormat() {
+        this(",", false, "\"", false, false, ";", null, null);
+    }
+
+    @JsonIgnore
+    @Override
+    public String getFormat() {
+        return "csv";
+    }
+
+    /**
+     * Generate options for connector
+     * @param includePrefix true will need append key and value when format is json avro csv
+     * @return options
+     */
+    @Override
+    public Map<String, String> generateOptions(boolean includePrefix) {

Review Comment:
   ok



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [incubator-inlong] dockerzhang merged pull request #3886: [INLONG-3884][Sort] Add CSV format for ExtractNode and LoadNode

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #3886:
URL: https://github.com/apache/incubator-inlong/pull/3886


-- 
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: commits-unsubscribe@inlong.apache.org

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