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 2023/01/03 03:22:45 UTC

[GitHub] [inlong] kuansix opened a new pull request, #7122: [INLONG-7121][Sort] Repair bug for MongoDb parse flink sql

kuansix opened a new pull request, #7122:
URL: https://github.com/apache/inlong/pull/7122

   ### Prepare a Pull Request
   - Title Example: [INLONG-7121][Sort] Repair bug for MongoDb parse flink sql
   - Fixes #7121 
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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] [inlong] gong merged pull request #7122: [INLONG-7121][Sort] Fix the parsing error of Flink SQL for MongoDB

Posted by GitBox <gi...@apache.org>.
gong merged PR #7122:
URL: https://github.com/apache/inlong/pull/7122


-- 
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] [inlong] healchow commented on a diff in pull request #7122: [INLONG-7121][Sort] Repair bug for MongoDb parse flink sql

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #7122:
URL: https://github.com/apache/inlong/pull/7122#discussion_r1060311394


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -890,10 +910,13 @@ private String parseFields(List<FieldInfo> fields, Node node) {
      * Generate primary key format in sql
      *
      * @param primaryKey The primary key of table
+     * @param filterPrimaryKey filter PrimaryKey, use for mongo
      * @return Primary key format in sql
      */
-    private String genPrimaryKey(String primaryKey) {
-        if (StringUtils.isNotBlank(primaryKey)) {
+    private String genPrimaryKey(String primaryKey, String filterPrimaryKey) {
+        boolean checkPrimaryKeyFlag = StringUtils.isNotBlank(primaryKey)
+                && (StringUtils.isBlank(filterPrimaryKey) || !primaryKey.contains(filterPrimaryKey));

Review Comment:
   Will there is problem using the `contains` method? For example, when primaryKey="global_id" and filterPrimaryKey="id".



-- 
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] [inlong] gong commented on a diff in pull request #7122: [INLONG-7121][Sort] Repair bug for MongoDb parse flink sql

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


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -890,10 +910,13 @@ private String parseFields(List<FieldInfo> fields, Node node) {
      * Generate primary key format in sql
      *
      * @param primaryKey The primary key of table
+     * @param filterPrimaryKey filter PrimaryKey, use for mongo
      * @return Primary key format in sql
      */
-    private String genPrimaryKey(String primaryKey) {
-        if (StringUtils.isNotBlank(primaryKey)) {
+    private String genPrimaryKey(String primaryKey, String filterPrimaryKey) {
+        boolean checkPrimaryKeyFlag = StringUtils.isNotBlank(primaryKey)
+                && (filterPrimaryKey.isEmpty() || !primaryKey.contains(filterPrimaryKey));
+        if (checkPrimaryKeyFlag) {

Review Comment:
   NPE when filterPrimaryKey is null



-- 
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] [inlong] gong commented on a diff in pull request #7122: [INLONG-7121][Sort] Fix the parsing error of Flink SQL for MongoDB

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


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -890,10 +910,13 @@ private String parseFields(List<FieldInfo> fields, Node node) {
      * Generate primary key format in sql
      *
      * @param primaryKey The primary key of table
+     * @param filterPrimaryKey filter PrimaryKey, use for mongo
      * @return Primary key format in sql
      */
-    private String genPrimaryKey(String primaryKey) {
-        if (StringUtils.isNotBlank(primaryKey)) {
+    private String genPrimaryKey(String primaryKey, String filterPrimaryKey) {
+        boolean checkPrimaryKeyFlag = StringUtils.isNotBlank(primaryKey)
+                && (StringUtils.isBlank(filterPrimaryKey) || !primaryKey.contains(filterPrimaryKey));

Review Comment:
   @kuansix you need modify to use `equals`



-- 
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] [inlong] gong commented on a diff in pull request #7122: [INLONG-7121][Sort] Repair bug for MongoDb parse flink sql

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


##########
inlong-sort/sort-core/src/main/java/org/apache/inlong/sort/parser/impl/FlinkSqlParser.java:
##########
@@ -890,10 +910,13 @@ private String parseFields(List<FieldInfo> fields, Node node) {
      * Generate primary key format in sql
      *
      * @param primaryKey The primary key of table
+     * @param filterPrimaryKey filter PrimaryKey, use for mongo
      * @return Primary key format in sql
      */
-    private String genPrimaryKey(String primaryKey) {
-        if (StringUtils.isNotBlank(primaryKey)) {
+    private String genPrimaryKey(String primaryKey, String filterPrimaryKey) {
+        boolean checkPrimaryKeyFlag = StringUtils.isNotBlank(primaryKey)
+                && (filterPrimaryKey.isEmpty() || !primaryKey.contains(filterPrimaryKey));
+        if (checkPrimaryKeyFlag) {

Review Comment:
   NPE when filterPrimaryKey is null and maybe `||` can be replaced by `&&`



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