Repository navigation
feat: run SQL statements inside an MCQA (SQLRT) session - #6
Merged
dingxin-tech merged 1 commit intoSep 22, 2026
Merged
Conversation
Owner
|
This branch has conflicts that must be resolved |
This was referenced Sep 22, 2026
M-B of the interface gap matrix: JDBC MaxQA and `SQLExecutor(INTERACTIVE)`
could not be exercised locally at all, because a `SQLRT` instance was refused
as "one SQL task required" and the instance information KV had no handler.
- `Instance/Job/Tasks/SQLRT` creates a session instance that stays `Running`
until the client PUTs `Instance/Status=Terminated` or it idles past
`--session-ttl` (idle, not age: an interactive session outlives one
statement). Sessions are swept on idle time so they cannot wedge instance
creation.
- `GET/PUT .../instances/{id}?info&taskname=` implements the sub-query channel
the Java SDK actually uses: `query` and `cancel` writes, `status`,
`progress`, `result` and `result_<id>` reads, answered with the SDK's own
object status codes so its polling loops terminate. Statements execute with
the server lock released, so a poll during a long query sees `running`.
- Sub-query answers are CSV with a column-name header line, which is what
`CSVRecordParser#parse` builds the schema from; the one-shot offline result
format is unchanged.
- Unknown instances, unknown information keys and stopped sessions return
structured answers, never an empty 200.
Not simulated, and said so in docs and `/capabilities` rather than left silent:
named-session attach (equal names create separate sessions), MaxQA v2 under the
`/mcqa` prefix, instance-tunnel download of sub-query results, per-statement
statistics, and isolation of session-scoped SQL state.
Consumer evidence: `tests/java/src/test/java/McqaSessionTest.java` drives the
real SDK (4/4 against a locally built binary) and caught two things the Go
suite did not — a `Server.mu` re-entrance that deadlocked the emulator once a
session was alive, and information bodies rooted at `Instance`, not
`InstanceTaskInfo`. `go test -race ./internal/...` and `go vet` pass.
TonyStack2026
force-pushed
the
tony/em-mcqa-session
branch
from
September 22, 2026 03:21
ae488e1 to
4804dc4
Compare
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.
Why
M-B of the interface gap matrix:
SQLExecutor(INTERACTIVE)and the JDBC MaxQA path could not be exercised locally at all — aSQLRTtask instance was refused as "one SQL task required", and the instance information KV (?info) had no handler.What
Instance/Job/Tasks/SQLRTcreates a session instance that staysRunninguntil the client stops it (PUTwithInstance/Status=Terminated) or it idles past--session-ttl. Idle, not age: an interactive session is expected to outlive one statement.GET/PUT .../instances/{id}?info&taskname=implements the sub-query channel:query/cancelwrites,status/progress/result/result_<id>reads, answered with the object status codescom.aliyun.odps.Sessionpolls on (2/4/5/6) so its loops terminate. Unknown keys, unknown instances and stopped sessions get structured answers, never an empty 200.running— the same shape as the service.CSVRecordParser#parsebuilds its schema from that line. The offline one-shot result format is untouched./capabilitiesdeclaresmcqa, and the remaining gaps are named individually instead of riding along on a blanketmcqaentry.Deliberate boundaries (stated, not silently missing)
Named-session attach (equal names create separate sessions — pinned by
TestMCQASessionNamesDoNotAttach), MaxQA v2 under the/mcqaprefix, instance-tunnel download of sub-query results, per-statement statistics, and isolation of session-scoped SQL state.Evidence
go test -race ./internal/...andgo vet: green (9 new session cases, including?infoon a one-shot instance and idle expiry).tests/java/src/test/java/McqaSessionTest.javadrives the real SDK (SQLExecutor,useInstanceTunnel(false)): 4/4 locally;UdfMetadataTest4/4 andEmulatorTest26/26 unchanged;tests/python/run.py30/0 on a freshly started server built from this commit.Instance(the SDK model carries@Root(name = "Instance"), notInstanceTaskInfo), and aServer.mure-entrance in the instance sweep that deadlocked the whole emulator —/readyzincluded — as soon as a session was alive.Notes for review
main, so this touches the/capabilitiesline that feat: metadata-plane fault injection and write-grant enforcement #5 also edits: if feat: metadata-plane fault injection and write-grant enforcement #5 lands first there is a one-line conflict there, nothing else.useInstanceTunnel(false)in the acceptance test is deliberate. With the default the SDK reads sub-query results over the instance tunnel and, when that fails, silently re-runs the statement offline — a test written that way would pass with nothing implemented on the session plane.