jackjlli commented on a change in pull request #3993: In TableConfig, add
checks for mandatory fields
URL: https://github.com/apache/incubator-pinot/pull/3993#discussion_r267555038
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/config/TableConfig.java
##########
@@ -118,14 +118,24 @@ public static TableConfig fromJsonString(String
jsonString)
@Nonnull
public static TableConfig fromJSONConfig(@Nonnull JsonNode jsonConfig)
throws IOException {
+ // Mandatory fields
+ Preconditions.checkState(jsonConfig.has(TABLE_TYPE_KEY), "Table type is
missing");
TableType tableType =
TableType.valueOf(jsonConfig.get(TABLE_TYPE_KEY).asText().toUpperCase());
+ Preconditions.checkState(jsonConfig.has(TABLE_NAME_KEY), "Table name is
missing");
String tableName =
TableNameBuilder.forType(tableType).tableNameWithType(jsonConfig.get(TABLE_NAME_KEY).asText());
-
+ Preconditions
+ .checkState(jsonConfig.has(VALIDATION_CONFIG_KEY), "Mandatory config
'%s' is missing", VALIDATION_CONFIG_KEY);
Review comment:
Since `"Mandatory config '%s' is missing"` is commonly used here, can we put
it as a final static variable in the same class?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]