You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "EricJoy2048 (via GitHub)" <gi...@apache.org> on 2023/05/10 07:47:10 UTC

[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #3990: [Improve][Connector][PulsarSource]Improve pulsar deserialization

EricJoy2048 commented on code in PR #3990:
URL: https://github.com/apache/incubator-seatunnel/pull/3990#discussion_r1189485369


##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java:
##########
@@ -167,8 +174,20 @@ public class SourceProperties {
                     .longType()
                     .noDefaultValue()
                     .withDescription("Stop from the specified epoch timestamp (in milliseconds)");
+    public static final Option<String> FORMAT =
+            Options.key("format")
+                    .stringType()
+                    .noDefaultValue()

Review Comment:
   No defaule value? Or the default value is `json`? I suggest define the default value in option.  `public static final String DEFAULT_FORMAT = "json";` is not a good way.



##########
seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java:
##########
@@ -167,8 +174,20 @@ public class SourceProperties {
                     .longType()
                     .noDefaultValue()
                     .withDescription("Stop from the specified epoch timestamp (in milliseconds)");
+    public static final Option<String> FORMAT =
+            Options.key("format")
+                    .stringType()
+                    .noDefaultValue()
+                    .withDescription(
+                            "Data format. The default format is json. Optional text format. The default field separator is \", \". "
+                                    + "If you customize the delimiter, add the \"field_delimiter\" option.");
+
+    public static final Option<String> FIELD_DELIMITER =
+            Options.key("field_delimiter")
+                    .stringType()
+                    .noDefaultValue()

Review Comment:
   same as above.



##########
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-pulsar-e2e/src/test/resources/pulsarsource_text_to_console.conf:
##########
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+######
+###### This config file is a demonstration of streaming processing in seatunnel config
+######
+
+env {
+    execution.parallelism = 1
+    job.mode = "STREAMING"
+}
+
+source {
+  Pulsar {
+    topic = "persistent://public/default/test"
+    topic-pattern = ""
+    subscription.name = "seatunnel_pulsar_sub"
+    client.service-url = "pulsar://localhost:6650"
+    admin.service-url = "http://localhost:8080"
+    result_table_name = "pulsar_table"
+    schema = {
+      fields {
+           id = bigint
+           c_string = string
+      }
+    }
+    format = text
+    # The default field delimiter is ","
+    field_delimiter = ","
+  }
+}
+
+transform {
+}
+
+sink {
+  Console {}

Review Comment:
   I think you need check the data read from the source. You can add a LocalFile Sink Or Pulsar Sink and then read the data from the target file(or topic when you use Pulsar Sink). Check every row and column.



-- 
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@seatunnel.apache.org

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