morrySnow opened a new pull request, #63208:
URL: https://github.com/apache/doris/pull/63208
## Summary
Fixes DORIS-25584: BITMAP/HLL/JSONB/VARIANT used as ARRAY/MAP/STRUCT
sub-elements at depth 3+ were silently accepted instead of being rejected.
## Root cause
In `DataType.validateCatalogDataType()`, all three complex-type branches
(ARRAY, MAP, STRUCT) only called `validateNestedType` when the direct child
type was `instanceof ScalarType`. When the child was itself complex (e.g. a MAP
inside an ARRAY), the guard failed and the entire subtree was skipped.
```
ARRAY<MAP<BITMAP, INT>>
└─ ARRAY branch: itemType = MAP → not ScalarType → SKIP ← bug
└─ MAP<BITMAP, INT> never validated → BITMAP silently accepted
```
Depth-2 nesting was correctly rejected (`ARRAY<BITMAP>` → error), but
depth-3+ bypassed the check.
## Fix
Remove the `instanceof ScalarType` guard; call `validateNestedType(parent,
child)` for **all** child types. Also move the STRUCT duplicate-field-name
check outside the former ScalarType guard.
## Tests
- 7 new unit tests in `DataTypeTest` covering all four Jira repro cases +
regression guards for existing depth-2 rejection + valid deep nesting.
- 1 new regression test suite `test_complex_disallowed_subtypes` with 6
`exception` cases and 1 valid-nesting acceptance case.
### What problem does this PR solve?
Issue Number: close #DORIS-25584
Problem Summary: `validateCatalogDataType` skipped validation of complex
child types due to an `instanceof ScalarType` guard, allowing
BITMAP/HLL/JSONB/VARIANT at depth 3+ to bypass the sub-type allowlist check.
### Release note
BITMAP, HLL, JSONB, and VARIANT are now correctly rejected as
ARRAY/MAP/STRUCT sub-elements even when nested 3 or more levels deep.
### Check List (For Author)
- Test: Regression test + Unit Test
- Behavior changed: Yes — depth-3+ nesting with BITMAP/HLL/JSONB/VARIANT now
throws AnalysisException 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]