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

   ### What problem does this PR solve?
   
   Flight SQL preparation currently returns the same `ResultMeta: string` 
schema for every SQL statement without analyzing it. Python ADBC 
`adbc_execute_schema()` consumes that prepared dataset schema directly, so 
valid queries report incorrect columns and invalid queries appear to succeed. 
Direct `GetSchema` is also unimplemented.
   
   Resolve output slots with the FE-only Nereids prepare planner and check 
table/column privileges before converting them to Arrow fields. Both Prepare 
and GetSchema use this resolver, including nested types, nullability, decimal 
precision and timestamp units. Invalid queries fail before a prepared handle is 
registered; metadata requests do not construct a query executor or dispatch BE 
fragments.
   
   Preserve JDBC preparation of commands using their FE result metadata 
(including the actual `StatusResult` protocol schema for commands without 
rows), and resolve USE/SWITCH prefixes within a temporary namespace scope. 
Session hints, statement resources and worker thread context are restored on 
success and failure. Parameter binding, arbitrary multi-statement batches, and 
commands without discoverable result metadata remain explicitly unsupported by 
schema discovery.
   
   Preparation now performs semantic analysis, so clients that prepare before 
executing incur an additional FE analysis pass. Physical planning and query 
execution remain in the existing execution path.
   
   ### Release note
   
   Fix Arrow Flight SQL schema discovery returning placeholder metadata instead 
of analyzed query columns.
   
   ### Check List (For Author)
   
   - Test
     - [x] Unit Test
     - [x] Manual test
   - Behavior changed:
     - [x] Yes. Prepare validates queries and reports their real output schema; 
GetSchema is implemented without executing the query.
   - Does this need documentation?
     - [x] No.
   
   Validation:
   
   - FE Checkstyle and 23 focused FE tests for the producer, query schema 
resolver and Arrow type mappings.
   - Regression reproduced before the fix: expected `[key_alias, name]`, 
received `[ResultMeta]`.
   - Local Flight RPC fixture using the Doris producer and FE test catalog, 
ADBC 1.11.0 and PyArrow 23.0.1: prepared/direct schema parity for scalar, 
timestamp, array, map, struct, information_schema and SHOW queries; 
syntax/unknown-column rejection followed by connection recovery; `SELECT 
sleep(30)` schema resolution without evaluating the expression.
   - Arrow Flight JDBC 19.0.0: preparation metadata for SELECT, USE-prefixed 
SELECT and CREATE DATABASE.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


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