You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/31 08:53:42 UTC

[GitHub] [incubator-seatunnel] bravekong opened a new pull request, #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

bravekong opened a new pull request, #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243

   [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported
   
   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1010308797


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();

Review Comment:
   I don't have any other questions, it's good enough to be able to throw specific exception information, like this, SchemaConvertException?



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


[GitHub] [incubator-seatunnel] EricJoy2048 merged pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
EricJoy2048 merged PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243


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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1010292919


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        

Review Comment:
   FYI 
   ![image](https://user-images.githubusercontent.com/16631152/199214091-272debf8-b35d-47ec-a98e-a5e2bd55ad12.png)
   



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


[GitHub] [incubator-seatunnel] bravekong commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
bravekong commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1011263011


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -114,7 +114,7 @@ public void prepare(FlinkEnvironment env) {
         try {
             schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
         } catch (JsonProcessingException e) {
-            e.printStackTrace();
+            log.error("schema parse error", e);

Review Comment:
   @CalvinKirs  I didn't understand what you meant by  throwing specific exception information yesterday, but now I got it.



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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1010307348


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        

Review Comment:
   Sorry, Please ignore me, I didn't look closely at the method you used



##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        

Review Comment:
   FYI 
   ![image](https://user-images.githubusercontent.com/16631152/199214091-272debf8-b35d-47ec-a98e-a5e2bd55ad12.png)
   



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


[GitHub] [incubator-seatunnel] CalvinKirs commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1010290282


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        

Review Comment:
   We need to determine what type it is, and then perform the corresponding conversion.



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


[GitHub] [incubator-seatunnel] bravekong commented on a diff in pull request #3243: [Bug] [seatunnel-connectors-flink-kafka] When json or avro are selected for kafka schema, a ClassCastException error is reported

Posted by GitBox <gi...@apache.org>.
bravekong commented on code in PR #3243:
URL: https://github.com/apache/incubator-seatunnel/pull/3243#discussion_r1011047972


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-kafka/src/main/java/org/apache/seatunnel/flink/kafka/source/KafkaTableStream.java:
##########
@@ -110,7 +111,12 @@ public void prepare(FlinkEnvironment env) {
         }
         String schemaContent = config.getString(SCHEMA);
         format = FormatType.from(config.getString(SOURCE_FORMAT).trim().toLowerCase());
-        schemaInfo = JsonUtils.parseArray(schemaContent);
+        try {
+            schemaInfo = JsonUtils.stringToJsonNode(schemaContent);
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();

Review Comment:
   > I don't have any other questions, it's good enough to be able to throw specific exception information, like this, SchemaConvertException?
   
   yes,I think you're right. I will update the code.



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