You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/10/15 21:39:45 UTC

[GitHub] [incubator-pinot] yupeng9 commented on a change in pull request #6149: add validation for upsert tables

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



##########
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.");
+    }

Review comment:
       I saw some checks in this class use precondition, others use `IllegalStateException`. Shall we make it consistent? @icefury71 




----------------------------------------------------------------
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:
users@infra.apache.org



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