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

   ### Background
   
   Iceberg catalogs can expose databases below the namespace configured by 
`external_catalog.name`. Ordinary discovery returns each direct child's 
relative name, while REST nested discovery returns complete names containing 
the root.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #56874 (introduced the reversed root order), #64304 (preserved 
it during the connector migration)
   PR Type: Bugfix
   
   Problem Summary:
   
   A catalog rooted at `root` discovers `root.db`, but subsequent operations 
can resolve `db.root` or `root.db.root`. If the reversed namespace contains a 
same-named table, loading succeeds with the wrong object. Resolve database 
names as the inverse of discovery in the common catalog implementation, keeping 
the configured root in one level. Reject rooted nested names outside that root 
and child levels that cannot be represented unambiguously.
   
   ### Details
   
   - **Change map:** Production +49/-14 lines; tests +379/-16 lines, including 
a SQL regression suite; no generated files or documentation changes.
   - **Frequency:** Affects catalogs using an external namespace root. Ordinary 
mode reverses the root/database order; nested mode appends an additional root.
   - **Root cause:** `toNamespace` always appended the external root after 
splitting the display name, while discovery started below that root and used 
two different display contracts.
   - **Why existing tests missed it:** Existing parity fixtures explicitly 
expected a trailing root, including the provider-construction fixture. They did 
not round-trip a discovered database against two different same-named tables.
   - **Fix:** Ordinary rooted names identify one direct child below the root. 
Nested rooted names already contain the root; remove the exact configured 
prefix before parsing child levels. Preserve literal dots in the configured 
root, direct-child dots and child whitespace. Leave unrooted dotted-name 
parsing unchanged. Use the same conversion for table/view metadata and DDL, 
including separate view facets.
   - **Other paths and branches:** Scan, write and procedure providers retain 
the common catalog resolver. `branch-4.2` also has the defect at 
`7523405f6aa8e9df3d110eb432fed1ff6e1c3418`; it needs a semantic backport in its 
legacy `IcebergMetadataOps`, rather than a mechanical cherry-pick of connector 
classes. That backport is not included here.
   - **Behavior change:** Operations address the namespace originally 
discovered. Rooted nested inputs must include the configured root; ambiguous 
dotted child levels fail explicitly. Existing remote objects are not migrated.
   
   ### Testing
   
   - The original three correctness reproducers fail on unmodified master. All 
19 new namespace cases now pass, covering reversed tables, nested descendants, 
root/child names containing dots, whitespace, target disappearance, and 
database/table DDL.
   - Full Iceberg connector suite through `run-fe-ut.sh`: 1,968 tests, zero 
failures/errors, 11 existing skips. Including upstream reactor dependencies: 
3,151 tests, zero failures/errors, the same 11 skips. `CUSTOM_MVN` restricts 
the reactor to the Iceberg module and its dependencies and enables Checkstyle; 
the repository test entry point is unchanged.
   - Checkstyle passes for all 21 selected projects; the connector import gate 
and `git diff --check` pass.
   - New SQL regression checks table identity through unique column binding 
with `LIMIT 0`, expected unknown-column errors, cache refresh, and 
CREATE/RENAME routing. Its syntax compiles with the regression framework's 
Groovy 4.0.19. Live SQL/REST execution is pending.
   - Full FE build: pending completion.
   
   ### Release note
   
   Fix Iceberg catalogs configured with `external_catalog.name` loading the 
wrong namespace or failing to find discovered databases and tables. Rooted 
nested names must include the configured root, and ambiguous dotted child 
levels are rejected explicitly.
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test
       - [ ] Regression test execution (suite added; live cluster run pending)
       - [ ] Manual test
       - [ ] No need to test
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No; no configuration is added, and the 
corrected name contract is described in the release note.
   - Pre-submission status: Partially verified: local component tests, 
Checkstyle, import gate and regression syntax pass; full FE build, live 
SQL/REST regression and remote CI remain pending.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Code, tests and this description
   - Human review: Pending
   


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