Repository navigation
test(arrow/flight/flightsql): add client tests for Substrait prepared statements - #1383
Merged
zeroshade merged 1 commit intoOct 19, 2026
Conversation
… statements Cover Client.PrepareSubstrait and Txn.PrepareSubstrait in FlightSqlClientSuite: the CreatePreparedSubstraitPlan action carries the plan bytes, version and transaction ID, the returned handle and schemas are parsed, and the is_update hint survives the round trip for the absent, false and true cases. Closes apache#1267
zeroshade
approved these changes
Oct 19, 2026
zeroshade
left a comment
Member
There was a problem hiding this comment.
Thanks, this fills the client-side gap left by #732. I checked that the tests catch real regressions: removing Version from either request, or TransactionId from the transaction request, makes them fail. Two optional nits:
- The
IsUpdate*andTxntests usedefer prepared.Close(...), which discards the error.s.NoError(prepared.Close(...)), as inTestPrepareSubstrait, would also catch a broken close. TestTxnPrepareSubstraitusesdeferto check its begin-transaction mock, while the helper usest.Cleanup. Either works, but one style would be easier to read.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Arrow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Arrow handles maintainer review:
CONTRIBUTING.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
#732 added server-side coverage for
CreatePreparedSubstraitPlan, but the review on that PR noted that the client path (Client.PrepareSubstraitandTxn.PrepareSubstrait) had no dedicated tests.FlightSqlClientSuiteonly exercised SQL prepared statements, so a regression in how the Substrait action is built or how its result is parsed would go unnoticed.What changes are included in this PR?
Four new cases in
FlightSqlClientSuiteinarrow/flight/flightsql/client_test.go, using the same mockedDoActionstream pattern as the existingTestPreparedStatement*tests:TestPrepareSubstrait: theCreatePreparedSubstraitPlanaction carries the plan bytes and Substrait version; the returned handle, dataset schema and parameter schema are parsed;IsUpdatereports no hint whenis_updateis absent; the statement executes through the sharedCommandPreparedStatementQuerypath and closes cleanly.TestPrepareSubstraitWithIsUpdateFalseandTestPrepareSubstraitWithIsUpdateTrue: theis_updatehint survives the round trip for both values, mirroring the server-sideTestExecutePreparedSubstrait*cases.TestTxnPrepareSubstrait:Txn.PrepareSubstraitsends the transaction ID fromBeginTransactiontogether with the plan.A small helper,
mockCreatePreparedSubstraitPlan, registers the create and close expectations so the four cases stay short. Query and update execution are not duplicated here, as noted in the issue, since Substrait and SQL prepared statements share the same execution paths after creation.Are these changes tested?
Yes, this PR only adds tests.
go test ./arrow/flight/flightsql/... -run TestFlightSqlClient: ok (29 subtests, 4 new)go vet ./arrow/flight/flightsql/andgofmt -l arrow/flight/flightsql: cleanAre there any user-facing changes?
No.
Closes #1267
AI/LLM disclosure