FrankChen021 commented on code in PR #19842:
URL: https://github.com/apache/druid/pull/19842#discussion_r3690441937


##########
server/src/main/java/org/apache/druid/catalog/model/ClusteredValueGroupsBaseTableMetadata.java:
##########
@@ -212,16 +215,38 @@ private DimensionSchema toDimensionSchema(ColumnSpec 
column, @Nullable Dimension
     if (ColumnType.NESTED_DATA.equals(druidType)) {
       return new NestedDataColumnSchema(column.name(), 
NestedDataColumnSchema.DEFAULT_FORMAT_VERSION);
     }
-    // Other complex types cannot be ingested into a clustered base table: 
there is no dimension handler for them,
-    // and clustered base tables have no aggregators to produce them.
+    if (druidType.is(ValueType.COMPLEX)) {
+      return complexDimensionSchema(column.name(), druidType);

Review Comment:
   [P2] Reject handler schemas that change the declared type
   
   This path accepts the provider's DimensionSchema without checking that 
schema.getColumnType() equals the catalog's declared complex type. The new test 
demonstrates the problem by declaring COMPLEX<clusteredBaseTableTestType> but 
producing a DoubleDimensionSchema. During ingestion, 
DimensionSchema.getDimensionHandler() then selects the double handler from that 
returned schema, so complex values fail conversion or are stored as a type that 
contradicts the sealed catalog schema. Apply the same type-consistency check 
used for custom schemas before accepting the provider result.



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

Reply via email to