morningman opened a new pull request, #70796: URL: https://github.com/apache/doris/pull/70796
### Background A Flight SQL client reads a query's result with DoGet from the endpoints the FE returns; a result a BE holds is read from that BE's Flight server, directly or through `public_host` / `arrow_flight_sql_proxy_port`. The BE keeps no client session, only the result buffer the ticket names. Since #67966 the FE serves the Flight session actions, so the `catalog` option that the Flight SQL JDBC driver sets for `?catalog=<name>` switches the session's current catalog. ### What problem does this PR solve? Issue Number: #67578 Related PR: #67966 (made the FE accept the `catalog` option, so such a URL connects and then fails on BE-held results) PR Type: Bugfix Problem Summary: With `?catalog=<name>` in a Flight SQL JDBC URL, the connection opens and the statements the FE answers itself (SHOW, SET, metadata) work, but every query whose result a BE holds fails. The driver opens a connection to each endpoint location and sets `catalog` on it before reading, and the BE answered `UNIMPLEMENTED: SetSessionOptions not implemented`. The BE now accepts `catalog` and `schema` without effect, since the FE session that issued the ticket already fixed both, and refuses any other option with INVALID_NAME. ADBC, and JDBC without `catalog`, see no change. Flight SQL JDBC 19.0.0, `jdbc:arrow-flight-sql://<fe>:<port>/?catalog=internal&useEncryption=false`, `SELECT k FROM db.t`: ``` before: java.sql.SQLException: ... INVALID_ARGUMENT: ... UNIMPLEMENTED: SetSessionOptions not implemented after: 1, 2, 3 ``` ### Details - **Frequency:** Always, for the Flight SQL JDBC driver with a `catalog` URL property (seen with 17.0.0 and 19.0.0), on every query whose result a BE holds, read directly or through a BE proxy. - **Root cause:** `doris::flight::FlightSqlServer` did not override `SetSessionOptions`, so Arrow's `FlightSqlServerBase` answered NotImplemented, while the JDBC driver sets its `catalog` property on the client it builds for each endpoint location (`ArrowFlightSqlClientHandler.getStreams`) and treats a refusal as a failed read. - **Why existing tests missed it:** `arrow_flight_sql_p0/test_session_options` connects the JDBC driver with `?catalog=internal` but only runs `SHOW VARIABLES`, which the FE answers itself; the other Flight suites use the framework URL, whose `catalog=` sits in the path where the driver ignores it, or raw Flight clients. No BE unit test covered the BE Flight server's actions. - **Fix:** The BE implements `SetSessionOptions`: `catalog` and `schema` are accepted and change nothing, any other name is answered INVALID_NAME, so the BE never reports success for an option that cannot take effect. The fix sits on the BE because the driver itself sends the option to each endpoint; the FE cannot prevent that. - **Other paths and branches:** GetSessionOptions and CloseSession are never sent to endpoints by the JDBC or ADBC drivers and stay unimplemented on the BE; the ADBC driver sets options only on its FE connection. branch-4.2 / 4.1 / 4.0 / 3.1 lack #67966, so there a JDBC URL with `catalog` fails to connect at all; this fix matters there only together with #67966. ### Testing - Regression `arrow_flight_sql_p0/test_session_options`, extended to read a BE-held result over a JDBC connection with `?catalog=internal`: on a cluster built without the fix it fails with `UNIMPLEMENTED: SetSessionOptions not implemented`; with the fix it passes, and its `.out` was generated by the regression script. - BE unit test `FlightSqlSessionOptionsTest` sends the action over gRPC to a real `FlightSqlServer`: `catalog` / `schema` come back without errors, other names (and `Catalog`) as INVALID_NAME. - Locally, 2 FEs and 2 BEs with ADBC 1.12.0, JDBC 19.0.0 (with and without `catalog`) and raw pyarrow: results spread over both BEs read correctly, directly and through an L4 proxy named by `public_host` / `arrow_flight_sql_proxy_port`, including reads the proxy sends to the BE that does not hold the result. The whole `arrow_flight_sql_p0` directory passes. ### Release note Fix Arrow Flight SQL JDBC connections whose URL sets `catalog`: queries whose results BEs hold failed with `SetSessionOptions not implemented`. ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: Claude Code (Claude Opus 5.5) - Generated: the BE change, the unit and regression tests, and this description - Human review: not stated -- 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]
