1fanwang opened a new pull request, #25364: URL: https://github.com/apache/datafusion/pull/25364
## Which issue does this PR close? - Closes https://github.com/apache/datafusion/issues/15978. ## Rationale for this change Prepared-statement clients get no type for LIMIT/OFFSET arguments even when the query executes correctly. A later untyped occurrence can also erase an already inferred parameter type. Prior work: https://github.com/apache/datafusion/pull/15980 and https://github.com/apache/datafusion/pull/23260. ## What changes are included in this PR? Default bare row-count parameters to Int64 only after collecting other type information. Preserve known fields and keep incomplete PREPARE signatures deferred rather than dropping unknown positions. ## What is the testing strategy for this PR? The tests plan, bind and execute real SQL, including mixed-type PREPARE statements. The same command ran on the base with the regression tests added, then on the fix, using Linux and Rust 1.98.1: ```sh CARGO_BUILD_JOBS=2 cargo test --locked --profile ci -p datafusion \ --test core_integration test_limit_offset_parameters \ -- --nocapture --test-threads=1 ``` | # | Scenario | Command | Result | | --- | --- | --- | --- | | 1 | LIMIT parameter metadata | Above | None becomes Int64; the query still returns 20 | Before: ```text assertion `left == right` failed: SELECT 20 AS value LIMIT $1 left: {"$1": None} right: {"$1": Some(Int64)} ``` After: ```text parameters={"$1": Some(Int64)} +-------+ | value | +-------+ | 20 | +-------+ ``` <details><summary>Additional raw PREPARE output</summary> Before: ```text test sql::select::test_limit_offset_parameters_prepare_execute ... Prepare: "page" [] ``` After: ```text test sql::select::test_limit_offset_parameters_prepare_execute ... Prepare: "page" [Int64, Int64] ``` </details> ## Are there any user-facing changes? Yes. Parameter metadata supplies integer types for otherwise-untyped LIMIT/OFFSET arguments while retaining known types and field metadata. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
