FrankChen021 commented on code in PR #19770:
URL: https://github.com/apache/druid/pull/19770#discussion_r3657341491
##########
server/src/main/java/org/apache/druid/catalog/model/ClusteredValueGroupsBaseTableMetadata.java:
##########
@@ -118,19 +148,44 @@ public ClusteredValueGroupsBaseTableProjectionSpec
createSpec(List<ColumnSpec> c
);
}
}
+ for (String customized : customSchemas.keySet()) {
+ if (!declaredNames.contains(customized)) {
+ throw InvalidInput.exception(
+ "columnSchemas entry [%s] does not customize a declared column;
column schemas do not define columns,"
+ + " declare [%s] in the table's column list",
+ customized,
+ customized
+ );
+ }
+ }
return ClusteredValueGroupsBaseTableProjectionSpec.builder()
.virtualColumns(virtualColumns)
.columns(specColumns)
.clusteringColumns(clusteringColumns)
.build();
}
- private static DimensionSchema toDimensionSchema(ColumnSpec column)
+ private Map<String, DimensionSchema> indexColumnSchemas()
+ {
+ final Map<String, DimensionSchema> customSchemas = new HashMap<>();
+ for (DimensionSchema schema : columnSchemas) {
+ if (customSchemas.put(schema.getName(), schema) != null) {
Review Comment:
[P2] Reject null column-schema entries
Jackson permits null list elements, so a payload such as
`"columnSchemas":[null]` reaches catalog validation and throws an NPE at
`schema.getName()` instead of returning an `InvalidInput` response. Explicitly
reject null entries before indexing the schemas.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]