morrySnow opened a new pull request, #63621:
URL: https://github.com/apache/doris/pull/63621

   ### What problem does this PR solve?
   
   Issue Number: close #DORIS-25583
   
   Problem Summary: `MAP<MAP/ARRAY/STRUCT, V>` was silently accepted during 
table creation. The validation in `DataType.validateCatalogDataType()` called 
`validateNestedType()` for both key and value of a MAP, but `mapSubTypes` 
included complex types (ARRAY, MAP, STRUCT), so complex key types passed 
through without error. MAP key types must be restricted to primitive types 
only, as complex key types are not supported by the execution engine.
   
   The fix adds an explicit check before validating MAP key types: if the key 
type is a complex type, an `AnalysisException` is thrown with a clear message: 
`MAP key type must be a primitive type but get <type>`.
   
   ### Release note
   
   CREATE TABLE with MAP<ARRAY<...>/MAP<.../STRUCT<...>, V> now correctly 
raises an error: `MAP key type must be a primitive type`. Previously such DDL 
was silently accepted and could cause undefined behavior at runtime.
   
   ### Check List (For Author)
   
   - Test: Regression test (`test_complex_disallowed_subtypes`) / Unit Test 
(`CreateTableCommandTest#testCreateTableWithComplexMapKey`)
   - Behavior changed: Yes — MAP<ARRAY/MAP/STRUCT, V> DDL now fails with a 
clear error instead of being silently accepted
   - Does this need documentation: No


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