xiangfu0 commented on code in PR #18710:
URL: https://github.com/apache/pinot/pull/18710#discussion_r3388168015


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -1603,6 +1604,23 @@ private static void 
validateIndexingConfigAndFieldConfigList(TableConfig tableCo
 
     
validateMultiColumnTextIndex(indexingConfig.getMultiColumnTextIndexConfig());
 
+    // OPEN_STRUCT materialized child columns use a reserved separator '$' in 
their name. When any
+    // schema field is OPEN_STRUCT, reject user columns whose names contain 
'$' to prevent naming
+    // collisions with future per-key materialized columns (col$key) or the 
sparse column
+    // (col$__sparse__). This validation runs here (with full schema access) 
rather than per-field
+    // because each OpenStructIndexType.validate() call only sees one field at 
a time.
+    boolean anyOpenStruct = schema.getAllFieldSpecs().stream()
+        .anyMatch(fs -> fs.getDataType() == DataType.OPEN_STRUCT);
+    if (anyOpenStruct) {
+      for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) {
+        Preconditions.checkState(
+            fieldSpec.getDataType() == DataType.OPEN_STRUCT

Review Comment:
   This still allows `$` in the OPEN_STRUCT parent name itself. A schema column 
like `metrics$foo` passes this check, but materialized children become 
`metrics$foo$key` and `OpenStructNaming.parseParentColumn()/parseKey()` split 
on the first `$`, so they round-trip back to parent `metrics` and key 
`foo$key`. That will misidentify child vs sparse columns once immutable segment 
loading starts. Please reject `$` in OPEN_STRUCT parent names too, or add 
escaping plus symmetric parse/build logic.



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