gianm commented on code in PR #19845:
URL: https://github.com/apache/druid/pull/19845#discussion_r3808587267
##########
server/src/main/java/org/apache/druid/catalog/model/table/DatasourceDefn.java:
##########
@@ -107,18 +106,6 @@ public void validate(ResolvedTable table)
super.validate(table);
final DatasourceBaseTableMetadata baseTable =
table.decodeProperty(BASE_TABLE_PROPERTY);
if (baseTable != null) {
Review Comment:
There's a `baseTable != null` check in `CompactionTask` too, added in
#19597, which treats the spec as authoritative if `baseTable` is set. Won't
something need to change there too? I'm wondering if the additional fields will
be unintentionally deleted by compaction.
##########
processing/src/main/java/org/apache/druid/data/input/impl/ClusteredValueGroupsBaseTableProjectionSpec.java:
##########
@@ -229,6 +229,35 @@ public boolean
hasEqualCompactionState(BaseTableProjectionSpec other)
.equals(((ClusteredValueGroupsBaseTableProjectionSpec)
other).withoutQueryGranularity());
}
+ /**
+ * Appends the given columns after the declared ones, which keeps the
clustering columns the leading prefix of
+ * {@link #getColumns()}.
+ */
+ @Override
+ public ClusteredValueGroupsBaseTableProjectionSpec withAdditionalColumns(
+ @Nullable List<DimensionSchema> additionalColumns
+ )
+ {
+ if (CollectionUtils.isNullOrEmpty(additionalColumns)) {
+ return this;
+ }
+ final List<DimensionSchema> revised = new ArrayList<>(columns.size() +
additionalColumns.size());
+ revised.addAll(columns);
+ for (DimensionSchema additionalColumn : additionalColumns) {
+ if (ColumnHolder.TIME_COLUMN_NAME.equals(additionalColumn.getName())) {
+ throw InvalidInput.exception(
Review Comment:
Should we also reject columns that match virtual column names? I think as
written, an additional column that matches a non-materialized virtual column
would be accepted here and then its value would be ignored. (Since the virtual
column would be used instead.)
--
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]