Skip to content

[fix](arrow-flight) Do not take the point-query short circuit on an Arrow Flight connection - #67487

Merged
morningman merged 1 commit into
apache:masterfrom
morningman:wt-adbc-67368
Sep 4, 2026
Merged

[fix](arrow-flight) Do not take the point-query short circuit on an Arrow Flight connection#67487
morningman merged 1 commit into
apache:masterfrom
morningman:wt-adbc-67368

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #67368

Related PR: #67381 (sibling fix in the same tracking series), #62259

Problem Summary:

A UNIQUE KEY point query that qualifies for the short-circuit path returned no Flight endpoint over Arrow Flight SQL. The client failed with

fetch arrow flight schema failed, no FlightSqlEndpointsLocations

and the row was silently dropped. The identical query with SET_VAR(enable_short_circuit_query=false) returned it on the same connection.

Root cause — the short circuit produces no Arrow result at either end, and nothing prevented an Arrow Flight connection from planning one:

  • It executes on PointQueryExecutor, not a Coordinator, and Coordinator/NereidsCoordinator are the only places that register a FlightSqlEndpointsLocation. StmtExecutor.executeAndSendResult then returns early through its Arrow Flight branch with nothing registered and without ever calling getNext(), so GetFlightInfo found an empty endpoint list.
  • The BE cannot be pointed at either. tablet_fetch_data serializes with VMysqlResultWriter into PTabletKeyLookupResponse.row_batch and runs no fragment, so the ArrowFlightResultBlockBuffer that fetch_arrow_flight_schema looks up by finst id never exists.

LogicalResultSinkToShortCircuitPointQuery did not look at the connect type, and enable_short_circuit_query defaults to true, so every ADBC / Arrow Flight JDBC point query on a MoW + light-schema-change + store_row_column table hit this. Prepared statements go through the same executeQueryStatement and failed identically.

Fix — keep Arrow Flight SQL on the normal execution path.

This has to be decided at plan time rather than when picking the executor: OlapScanNode.computeTabletInfo and several rewrite/property rules (ChildOutputPropertyDeriver, ShuffleKeyPruner, NestedColumnPruning, PruneOlapScanPartition) read StatementContext.isShortCircuitQuery() while the plan is being built, so flipping the flag later would run a coordinator over a plan shaped for a different execution mode. MySQL connections keep the short circuit unchanged.

Returning the point-query result from the FE instead was considered and rejected for now: FlightSqlChannel.addResult builds varchar vectors only, so every column would come back as Utf8, inconsistent with the normal Flight path. Full support (Arrow serialization in the BE lookup RPC plus a result buffer to hand out an endpoint) is a larger change and out of scope here.

Also refreshes a now-stale comment in StmtExecutor that said point queries reach the Arrow Flight deferral gate.

Release note

Fix Arrow Flight SQL returning no endpoint (no FlightSqlEndpointsLocations) for a point query that hits the short-circuit path.

Check List (For Author)

  • Test
    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason

regression-test/suites/arrow_flight_sql_p0/test_point_query_over_arrow_flight.groovy uses the table from the issue and holds both a MySQL and an Arrow Flight connection. It asserts the MySQL explain still contains SHORT-CIRCUIT (so a table that stopped qualifying fails loudly instead of making the rest pass for the wrong reason), that the Flight explain does not, that both protocols return the same row, and that the numeric columns stay numeric over Flight.

ShortCircuitPointQueryTest#testArrowFlightSqlConnectionDoesNotUseShortCircuit covers the rule itself and re-asserts that the same statement still short circuits on a MySQL connection.

Verified on a local single-FE + single-BE cluster, all three runs on the same cluster:

Run FE Result
1 with the fix All suites success, Test 1 suites, failed 0
2 guard temporarily disabled failedthe point query must not short circuit on an arrow flight connection
3 fix restored All suites success, Test 1 suites, failed 0

Run 2 is the negative control; the explain it captured is the bug itself, with a Flight result sink and the short circuit in one plan:

  VRESULT SINK
     ARROW_FLIGHT_PROTOCOL
  0:VOlapScanNode(28)
     ...
     SHORT-CIRCUIT

FE UT: Tests run: 8, Failures: 0, Errors: 0 for ShortCircuitPointQueryTest.

  • Behavior changed:

    • No.
    • Yes. A point query over Arrow Flight SQL is now planned on the normal execution path instead of the short circuit, so it returns its row instead of failing. It gives up the point-query latency benefit on that protocol; MySQL connections are unaffected.
  • Does this need documentation?

    • No.
    • Yes.

🤖 Generated with Claude Code

https://claude.ai/code/session_017omcvWDsxEc9AyU83aBZ2g

…rrow Flight connection

A UNIQUE KEY point query that qualifies for the short circuit returned no Flight
endpoint over Arrow Flight SQL, so the client failed with

    fetch arrow flight schema failed, no FlightSqlEndpointsLocations

and the row was silently dropped. `SET_VAR(enable_short_circuit_query=false)` on the
same connection returned it.

The short circuit produces no Arrow result at either end:

* It runs on PointQueryExecutor, not a Coordinator, and Coordinator/NereidsCoordinator
  are the only places that register a FlightSqlEndpointsLocation. StmtExecutor's Arrow
  Flight branch then returns early with nothing registered, never calling getNext(), so
  GetFlightInfo found an empty endpoint list.
* The BE cannot be pointed at either. tablet_fetch_data serializes with
  VMysqlResultWriter into PTabletKeyLookupResponse.row_batch and runs no fragment, so
  the ArrowFlightResultBlockBuffer that fetch_arrow_flight_schema looks up by finst id
  never exists.

Nothing gated the rewrite on the connect type, and enable_short_circuit_query defaults
to true, so every ADBC / Arrow Flight JDBC point query on a MoW + light-schema-change +
store_row_column table hit this. Prepared statements go through the same
executeQueryStatement and failed identically.

Keep Arrow Flight SQL on the normal execution path. This has to be decided at plan time
rather than when picking the executor: OlapScanNode.computeTabletInfo and several
rewrite and property rules read StatementContext.isShortCircuitQuery() while the plan is
being built, so flipping the flag later would run a coordinator over a plan shaped for a
different execution mode. MySQL connections keep the short circuit unchanged.

Also refreshes a now-stale comment in StmtExecutor that said point queries reach the
Arrow Flight deferral gate.

Verified on a local single-FE + single-BE cluster: the new regression test passes with
the fix, and fails without it on the same cluster, with the explain showing
`VRESULT SINK / ARROW_FLIGHT_PROTOCOL` and `SHORT-CIRCUIT` in one plan.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017omcvWDsxEc9AyU83aBZ2g
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morningman

Copy link
Copy Markdown
Contributor Author

run buildall

@morningman

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review result: request changes for one regression-test convention issue.

Critical checkpoints:

  • Goal and correctness: the planner-time Arrow Flight fence addresses the no-endpoint failure at the authoritative short-circuit marker, before partition pruning and physical-property consumers. Normal, EXPLAIN, Flight prepared-handle, SQL prepared, retry, matching-row, and empty-row paths were traced; no stale marker or alternate point-executor path remains for an Arrow connection.
  • Scope and clarity: the production change is focused to one enum gate plus a clarifying StmtExecutor comment. Error handling is not suppressed; Arrow is routed to the established coordinator path.
  • Concurrency and lifecycle: no new locks or shared mutable lifecycle are introduced. The stable volatile connection type is read during synchronous planning, and the existing deferred coordinator/result-buffer lifecycle spans GetFlightInfo and DoGet. Endpoint IDs match BE buffer IDs in both normal and parallel result-sink modes.
  • Configuration and compatibility: no config, persistence, transaction/write behavior, FE-BE field, storage format, or symbol compatibility changes are introduced. MySQL retains the short circuit; Arrow intentionally pays normal-plan cost until the point executor can produce Arrow results.
  • Tests: the FE unit test controls the marker and ordinary empty plan; the end-to-end regression controls MySQL eligibility, Flight planning, actual matching and missing results, type preservation, the disable hint, and a non-point query. I inspected but did not execute tests because this review environment explicitly prohibits builds/tests.
  • Observability: the existing endpoint/schema errors and coordinator logging are adequate for this narrow routing change; no new metric is required.
  • User focus and completion: no additional user focus was provided. Two review rounds converged with every candidate accepted, deduplicated, or dismissed with code evidence; the single accepted issue is inline below.

Separately, the current PR title check is failing because the workflow regex does not accept the arrow-flight scope. arrow_flight or arrow flight matches that checker. Compile, FE UT, and performance checks were still pending when this review was submitted.

hello-stephen pushed a commit that referenced this pull request Sep 3, 2026
…67491)

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #66957 (introduced the title-checker regression), #67487 (a
PR currently blocked by it)

Problem Summary:

Two independent bugs in the repository's `.github` tooling, both of
which make it easy to get a PR wrong for reasons unrelated to its
content.

---

#### 1. The PR title checker rejects any hyphen in the type or scope

```
[fix](arrow-flight) ...
[feature](inverted-index) ...
[improvement](github-actions) ...
```

**88 of the last 1500 commits on master use such a title**, including
#66957 itself — the change that introduced the current check. Its own
title, `[improvement](github-actions) Reduce redundant GitHub Actions
runs and checkouts`, would not pass the checker it added.

**Root cause.** #66957 replaced the `deepakputhraya/action-pr-title`
action with an inline `grep -qE` and kept the action's regex verbatim,
with the comment "Same regex as the previously used ... submodule". But
that action is **JavaScript**, where `\-` inside a character class is a
valid escape for a literal hyphen. **POSIX ERE has no such escape** — a
backslash inside a bracket expression is just a backslash. So

```
[a-zA-Z0-9 \-_]
```

does not mean "letters, digits, space, hyphen, underscore". It makes `\`
a member and then reads `-_` as a range endpoint, which leaves the
hyphen itself out of the set. Porting the pattern from JS to `grep`
silently changed its meaning.

The fix puts the literal hyphen last in the bracket expression, which is
how POSIX spells it:

```diff
-if ! grep -qE '\[([a-zA-Z0-9 \-_])+\]\(([a-zA-Z0-9 \-_])+\)(.*)' <<< "${TITLE}"; then
+if ! grep -qE '\[([a-zA-Z0-9 _-])+\]\(([a-zA-Z0-9 _-])+\)(.*)' <<< "${TITLE}"; then
```

A comment now records why the JS form cannot be restored verbatim, so
the pattern is not "fixed back" later.

#### 2. `.gitignore` ignores `.github`

`.gitignore` has had a bare `.github` entry under its `# other` section
since 9b5a464 (`[Feature][external catalog/lakesoul] support
lakesoul catalog`, #32164) — a change that otherwise has nothing to do
with CI and touched only those two `.gitignore` lines, so it looks
accidental.

The existing files under `.github` survived only because they were
already tracked when the entry was added; `.gitignore` does not affect
tracked files. The entry therefore has no useful effect today, and two
harmful ones:

* Any **new** file under `.github` — a workflow, an action,
`CODEOWNERS`, an issue template — is silently ignored. `git status` does
not list it and `git add` refuses it without `-f`, so it is easy to open
a PR that is missing it.
* Even for a **tracked** file, `git add .github/workflows/foo.yml`
prints `The following paths are ignored by one of your .gitignore files`
and exits non-zero, which breaks `git add ... && git commit ...` in
scripts. This happened while preparing this very PR.

```
$ git check-ignore -v --no-index .github/workflows/new-thing.yml
.gitignore:155:.github    .github/workflows/new-thing.yml
```
@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 50.00% (2/4) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 6.25% (4/64) 🎉
Increment coverage report
Complete coverage report

@morningman
morningman merged commit 099d5bd into apache:master Sep 4, 2026
32 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Arrow Flight SQL: short-circuit point query returns no Flight endpoint (no FlightSqlEndpointsLocations)

3 participants