Skip to content

fix: populate rowcount after async DML completion - #1016

Draft
aakash-saravanan-db wants to merge 1 commit into
mainfrom
aakash-saravanan-db/fix-async-dml-rowcount
Draft

aakash-saravanan-db wants to merge 1 commit into
mainfrom
aakash-saravanan-db/fix-async-dml-rowcount

Conversation

@aakash-saravanan-db

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • Bug Fix

Description

After async DML completes, Cursor.get_async_execution_result() leaves rowcount=-1 even when the server reports an affected-row count. Populate the result-set count from the kernel handle after await_result() or from Thrift operation status, then copy it to the cursor. Preserve zero counts, unknown counts as -1, and the fetched counter rows.

Thrift performs one additional GetOperationStatus request per async result retrieval. Kernel mode uses the existing cached count exposed by the companion binding change. Older kernel wheels remain supported and retain an unknown async count until upgraded; select the dependency floor and kernel pin once the binding release is available.

How is this tested?

  • Unit tests

  • Manually

  • Connector unit suite: 1,338 passed, four skipped. New regressions fail against the unmodified connector.

  • Native connector tests: four passed on standard and realtime routes with the rebuilt kernel wheel.

  • Actual changed connector on staging DBSQL: 28/28 DML cases, 256 assertions across kernel and Thrift. Covers 12 async write variants per backend and positive/zero synchronous UPDATE controls, counts before/after fetch, counter rows, metadata, table contents, async SELECT resets, and kernel reader re-fetches.

  • Black and diff whitespace checks passed for changed code. Fixtures were removed and the warehouse restored to STOPPED.

Related Tickets & Documents

Companion kernel Python binding: https://github.com/databricks/databricks-sql-kernel/pull/432

Carry affected-row counts from kernel handles and Thrift operation status into async result sets, then publish them on the cursor. Preserve zero, unknown counts, and fetched counter rows.

Signed-off-by: Aakash Saravanan <[email protected]>

This branch was previously deployed

1 inactive deployment
azure-prod — 43a2c93f Deployed Nov 10, 2026 by aakash-saravanan-db via test-with-coverage #1030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant