[fix](fe) Fix Type.exceedsMaxNestingDepth skipping MAP keyType recursion#63201
Merged
morrySnow merged 1 commit intoMay 13, 2026
Merged
Conversation
### What problem does this PR solve? Issue Number: close #DORIS-25592 Problem Summary: `Type.exceedsMaxNestingDepth` in the MAP branch only recursed into `valueType` and silently skipped `keyType`. A user could construct arbitrarily deep types via the MAP key path, bypassing the 9-layer nesting limit. ### Release note Fix MAP key-type nesting-depth check bypass: deeply-nested MAP key types are now correctly rejected with "Type exceeds the maximum nesting depth". ### Check List (For Author) - Test: FE Unit Test — TypeTest#testMapKeyPathDeepNestingDetected (new), TypeTest#testMapKeyPathNestingWithinLimit (new), TypeTest#testMapValuePathDeepNestingDetected (new, regression guard) - Behavior changed: Yes — MAP types with deep nesting via keyType path are now rejected as intended by the spec. - Does this need documentation: No Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
Contributor
There was a problem hiding this comment.
Review result: no blocking issues found.
Critical checkpoint conclusions:
- Goal and coverage: The PR fixes
Type.exceedsMaxNestingDepth()so MAP key types are traversed, closing the key-path bypass. The new tests cover within-limit MAP key nesting, over-limit MAP key nesting, and the existing MAP value path. - Scope and clarity: The production change is minimal and focused: one additional recursive check before the existing value-type recursion.
- Concurrency and lifecycle: Not applicable; this is pure immutable type validation logic with no shared mutable state, locks, threads, or lifecycle changes.
- Configuration and compatibility: No new configs, protocol fields, storage formats, persisted metadata, or rolling-upgrade compatibility concerns.
- Parallel code paths: ARRAY, STRUCT, and MAP value recursion remain intact; the missing MAP key recursion is now aligned with the other complex-type paths.
- Error handling: Existing caller behavior is preserved;
validateDataType()still raises the same maximum nesting-depth error whenexceedsMaxNestingDepth()returns true. - Tests:
mvn checkstyle:check -pl fe-corepassed. Focused unit test execution was attempted;mvn test -pl fe-core -Dtest=org.apache.doris.catalog.TypeTestfailed becausefe-foundationwas absent locally,mvn test -pl fe-core -am -Dtest=org.apache.doris.catalog.TypeTestfailed because upstream modules had no matching tests, and rerunning with-DfailIfNoTests=falseprogressed further but failed becausethirdparty/installed/bin/thriftis missing in this runner. - Observability: Not needed for this validation helper change.
- Transactions/persistence/data visibility: Not applicable.
- Performance: The added key recursion is bounded by
MAX_NESTING_DEPTHand only runs during type validation; no hot-path performance concern found.
User focus: no additional user-provided review focus was present.
Contributor
TPC-H: Total hot run time: 29617 ms |
Contributor
TPC-DS: Total hot run time: 171971 ms |
Contributor
FE UT Coverage ReportIncrement line coverage `` 🎉 |
Contributor
FE Regression Coverage ReportIncrement line coverage |
starocean999
approved these changes
May 13, 2026
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
github-actions Bot
pushed a commit
that referenced
this pull request
May 13, 2026
…ion (#63201) ## Summary `Type.exceedsMaxNestingDepth` in the MAP branch only recursed into `valueType` and silently skipped `keyType`. A user could construct arbitrarily deep types via the MAP key path, bypassing the 9-layer nesting limit. ### What problem does this PR solve? Problem Summary: ```java // Before fix — MAP branch: } else if (isMapType()) { MapType mapType = (MapType) this; return mapType.getValueType().exceedsMaxNestingDepth(d + 1); // keyType never checked } ``` ARRAY and STRUCT branches recursed correctly; only MAP missed the keyType path. ### Fix ```java } else if (isMapType()) { MapType mapType = (MapType) this; if (mapType.getKeyType().exceedsMaxNestingDepth(d + 1)) { return true; } return mapType.getValueType().exceedsMaxNestingDepth(d + 1); } ``` ### Tests Three new FE unit tests added to `TypeTest`: - `testMapKeyPathNestingWithinLimit` — `MAX_NESTING_DEPTH` levels via keyType → allowed (assertFalse) - `testMapKeyPathDeepNestingDetected` — `MAX_NESTING_DEPTH + 1` levels via keyType → rejected (assertTrue) - `testMapValuePathDeepNestingDetected` — regression guard: valueType path still detected (assertTrue) All 11 tests in `TypeTest` pass. ### Release note Fix MAP key-type nesting-depth check bypass: deeply-nested MAP key types are now correctly rejected with "Type exceeds the maximum nesting depth". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
github-actions Bot
pushed a commit
that referenced
this pull request
May 13, 2026
…ion (#63201) ## Summary `Type.exceedsMaxNestingDepth` in the MAP branch only recursed into `valueType` and silently skipped `keyType`. A user could construct arbitrarily deep types via the MAP key path, bypassing the 9-layer nesting limit. ### What problem does this PR solve? Problem Summary: ```java // Before fix — MAP branch: } else if (isMapType()) { MapType mapType = (MapType) this; return mapType.getValueType().exceedsMaxNestingDepth(d + 1); // keyType never checked } ``` ARRAY and STRUCT branches recursed correctly; only MAP missed the keyType path. ### Fix ```java } else if (isMapType()) { MapType mapType = (MapType) this; if (mapType.getKeyType().exceedsMaxNestingDepth(d + 1)) { return true; } return mapType.getValueType().exceedsMaxNestingDepth(d + 1); } ``` ### Tests Three new FE unit tests added to `TypeTest`: - `testMapKeyPathNestingWithinLimit` — `MAX_NESTING_DEPTH` levels via keyType → allowed (assertFalse) - `testMapKeyPathDeepNestingDetected` — `MAX_NESTING_DEPTH + 1` levels via keyType → rejected (assertTrue) - `testMapValuePathDeepNestingDetected` — regression guard: valueType path still detected (assertTrue) All 11 tests in `TypeTest` pass. ### Release note Fix MAP key-type nesting-depth check bypass: deeply-nested MAP key types are now correctly rejected with "Type exceeds the maximum nesting depth". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type.exceedsMaxNestingDepthin the MAP branch only recursed intovalueTypeand silently skippedkeyType. A user could construct arbitrarily deep types via the MAP key path, bypassing the 9-layer nesting limit.What problem does this PR solve?
Problem Summary:
ARRAY and STRUCT branches recursed correctly; only MAP missed the keyType path.
Fix
Tests
Three new FE unit tests added to
TypeTest:testMapKeyPathNestingWithinLimit—MAX_NESTING_DEPTHlevels via keyType → allowed (assertFalse)testMapKeyPathDeepNestingDetected—MAX_NESTING_DEPTH + 1levels via keyType → rejected (assertTrue)testMapValuePathDeepNestingDetected— regression guard: valueType path still detected (assertTrue)All 11 tests in
TypeTestpass.Release note
Fix MAP key-type nesting-depth check bypass: deeply-nested MAP key types are now correctly rejected with "Type exceeds the maximum nesting depth".
Check List (For Author)