Skip to content

ExecuteStatement reads a Limit of 1.0, 1.5 or "2" as no Limit, where DynamoDB reads 1.0 and 1.5 as 1 and refuses the string #1027

Closed

Description

@LeeroyHannigan

ExecuteStatement reads Limit only when the request sends it as a JSON integer. ExtendDB runs a statement whose Limit is 1.0, 1.5 or the string "2" as if the request had no Limit. Amazon DynamoDB reads 1.0 and 1.5 as 1 and returns one row on each page. It refuses the string with SerializationException before it looks up the table.

Measured in us-east-1 on 2026-11-14, each request twice with the same answer. The table has the key pk S HASH and sk S RANGE, and partition partiql-limit holds the four items row-1 to row-4. The SDK sends Limit as an integer, so the measurement wrote the bodies by hand.

Request body DynamoDB ExtendDB
{"Statement": "SELECT * FROM \"<table>\" WHERE pk = 'partiql-limit'", "ConsistentRead": true, "Limit": 1.0}, then the same with each NextToken one row on each page that has rows: row-1, row-2, row-3, row-4 all four rows on one page, with no NextToken
the same with "Limit": 1.5 one row on each page that has rows all four rows on one page, with no NextToken
{"Statement": "SELECT * FROM \"<missing table>\" WHERE pk = 'k'", "Limit": "2"} SerializationException: STRING_VALUE cannot be converted to Integer ResourceNotFoundException

Whether DynamoDB sends an empty page after row-4 is not part of the measurement. In the same measurement both sides give the same answers for these Limit values. 0 and -1 get 1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1 (with '-1' for -1) before the table lookup. 2147483647 and 2147483648, and the raw values 1E+2, 1e+20, 100000000000000000000 and 18446744073709551617, return the whole partition on one page with no NextToken.

ExtendDB at origin/main 95425f5 gives these answers on SQLite, SQLite in dev mode, PostgreSQL, MongoDB and Cassandra.

SingleRequest::without_parameters in crates/engine/src/partiql/mod.rs (line 213) sets limit: body.get("Limit").and_then(Value::as_i64) (line 238). as_i64 gives None for 1.0, 1.5 and "2", so the statement runs with no Limit. check_execute_statement in crates/engine/src/partiql/request_checks.rs (line 108) reads Limit the same way for its check of a value below 1 (line 112), so it passes these values too.

#720 (Query) and #563 (Scan) cover a fractional Limit on those operations, where ExtendDB answers SerializationException. Open PR #850 adds saturated_int32 in crates/core/src/types/query.rs for the Scan Limit, Segment and TotalSegments. It truncates a fraction toward zero and saturates a value outside the int32 range. No open issue or pull request changes how ExecuteStatement reads Limit.

Proposed change: read the ExecuteStatement Limit from any JSON number as saturated_int32 reads the Scan Limit, in both without_parameters and check_execute_statement. Refuse a string Limit with SerializationException and the text STRING_VALUE cannot be converted to Integer. A fraction below 1 and a Limit of another JSON type were not measured on ExecuteStatement.

Activity

  1. added a commit that references this issue on Nov 23, 2026
    d61f8af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions