Skip to content

feat(pyo3): expose statement row limit - #269

Merged
vuanhphung merged 4 commits into
mainfrom
vu-phung/pecoblr-4127-pyo3-row-limit
Aug 20, 2026
Merged

vuanhphung merged 4 commits into
mainfrom
vu-phung/pecoblr-4127-pyo3-row-limit

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Exposes Statement.set_row_limit(...) in the Python binding and forwards it to the existing kernel StatementSpec row limit. This lets Python clients apply the limit in the SEA request instead of truncating results locally.

Adds Python surface coverage and an opt-in live behavior test for None, 1, and 5. Unblocks PECOBLR-4127.

Validated with PyO3 cargo tests, formatting, and the core row-limit wire test.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Medium

Looks good overall — the PyO3 set_row_limit is a clean, correctly-documented passthrough to the well-tested kernel StatementSpec::row_limit(Option<i64>), with Python surface + live coverage added. One medium concern: the row_limit=0 live-test expectation may diverge from Databricks' documented "0 = no limit" semantics (see inline).

Comment thread pyo3/tests/test_execute.py Resolved
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues identified by the review bot.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Looks good — a clean, correct forwarding of set_row_limit that mirrors the existing set_sql setter and the well-documented kernel StatementSpec::row_limit semantics, with both surface and live test coverage. One low note about the unvalidated/untested negative-and-zero boundary.

Comment thread pyo3/src/statement.rs
}

/// Set the server-side row cap for this statement. ``None`` clears it.
fn set_row_limit(&mut self, row_limit: Option<i64>) -> PyResult<()> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Low — set_row_limit forwards any i64 through unchecked, including negative values (e.g. -1) and 0. Unlike bind_param, which deliberately rejects out-of-range ordinals client-side to surface a typed KernelError(InvalidArgument) rather than a wire-level rejection, both the kernel StatementSpec::row_limit and this binding accept negatives and defer to the SEA server. That's arguably consistent with the kernel's own (non-validating) contract, so this is not a correctness bug — but the live test only covers None, 1, 5, leaving the negative/0 boundary behavior unspecified and untested. Consider either documenting that out-of-range values are the server's responsibility, or asserting the boundary (e.g. that 0/negative raises) so the contract is pinned. Non-blocking.

@vuanhphung
vuanhphung added this pull request to the merge queue Aug 20, 2026
Merged via the queue into main with commit 9e3dbf9 Aug 20, 2026
24 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — da180e27 Deployed Aug 19, 2026 by oss-reviewer-bot[bot] via followup #741
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.

2 participants