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

   ### What problem does this PR solve?
   
   Issue Number: None
   
   On branch-4.1, `ExternalTable#getRemoteName()` defines the local table name 
as the fallback when the stored remote name is null or empty. 
`JdbcExternalTable#initSchema()` bypassed that API and passed the nullable 
field directly to JDBC metadata and identifier mapping.
   
   For JDBC, a null table pattern can enumerate columns from every table in the 
database. This can turn one table schema lookup into a multi-table result and 
produce misleading case-insensitive column conflicts for a `db.null` remote 
table.
   
   The same code path already uses the effective name for debug logging, 
comments, and scan table construction; schema initialization was the 
inconsistent path.
   
   ### How was it fixed?
   
   Resolve the effective remote table name once at the start of `initSchema()` 
and reuse it for:
   
   - JDBC column metadata lookup
   - remote-to-local column identifier mapping
   - conflict diagnostics
   
   Explicit remote-name mappings are preserved because `getRemoteName()` 
returns the stored value when present.
   
   ### Release note
   
   Fix JDBC external table schema lookup when a 4.1 table object has a missing 
remote table name.
   
   ### Check List (For Author)
   
   - Test
       - [x] Unit Test: `JdbcExternalTableTest` (2 tests)
       - [x] Red/green verified: before the fix the metadata call received null 
and the error contained `remote_db.null`; after the fix both tests pass
       - [x] `./run-fe-ut.sh --run 
org.apache.doris.datasource.jdbc.JdbcExternalTableTest` — full 28-module FE 
reactor `BUILD SUCCESS`
   - Behavior changed:
       - [x] Yes. A missing JDBC remote table name now falls back to the local 
table name instead of using JDBC null-pattern semantics.
   - Does this need documentation?
       - [x] No.
   
   Related: #65708 was closed because master has already migrated JDBC catalogs 
to the plugin-driven path and does not contain this branch-4.1 code path.


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