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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to