yupeng9 commented on a change in pull request #6149:
URL: https://github.com/apache/incubator-pinot/pull/6149#discussion_r505884895



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/util/TableConfigUtils.java
##########
@@ -230,6 +234,38 @@ private static void validateIngestionConfig(@Nullable 
IngestionConfig ingestionC
     }
   }
 
+  /**
+   * Validates the upsert-related configurations
+   *
+   */
+  private static void validateUpsertConfig(TableConfig tableConfig, Schema 
schema) {
+    if (tableConfig.getUpsertMode() == UpsertConfig.Mode.NONE) {
+      return;
+    }
+    // primary key exists
+    if (schema.getPrimaryKeyColumns() == null || 
schema.getPrimaryKeyColumns().isEmpty()) {
+      throw new IllegalStateException("Upsert table must have primary key 
columns in the schema.");
+    }
+    // replica group is configured for routing
+    if (tableConfig.getRoutingConfig() == null || 
!tableConfig.getRoutingConfig().getInstanceSelectorType()
+        .equalsIgnoreCase(RoutingConfig.REPLICA_GROUP_INSTANCE_SELECTOR_TYPE)) 
{
+      throw new IllegalStateException("Upsert table must use replicaGroup as 
the routing config.");
+    }

Review comment:
       why? this seems the same rewrite.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to