Skip to content

fix(connection): segregate implicit prepare cache by full list element types - #58

Merged
adsharma merged 1 commit into
mainfrom
issue-57
Oct 1, 2026
Merged

adsharma merged 1 commit into
mainfrom
issue-57

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Fixes #57.

Problem: Connection.execute(query, params) silently dropped rows / truncated values when a list-of-struct param needed a wider int type than the first call's. The Python-side cache key (_pybind_value_signature) inspected only the first list element, while C++ prepares the max logical type over ALL elements — so a narrow first call's plan was reused for wider later calls (300 bound as 44).

Fix: aggregate element signatures across the whole list (max int width, merged struct fields, merged nested lists/maps), mirroring C++ tryGetMaxLogicalType. Homogeneous int lists still key as INT64 like pyHomogeneousListType. Scalar int widths outside lists are still segregated (unchanged).

Tests: new regression test test_pybind_implicit_prepare_segregates_struct_list_by_int_width (fails on old code, passes on new); full test_pybind_implicit_prepare_cache + threading suites pass (11 passed). End-to-end repro from the issue verified fixed against a built overlay; one pre-existing quirk noted: RETURN r.d alongside MATCH projects the first row's value even with fresh query text (C++ binding behavior, out of scope).

Draft PR — stopping before ready-for-review per loop instructions.

…t types

_pybind_value_signature keyed list params on the first element only,
while C++ prepares the max logical type over ALL elements. Calls whose
first row was narrow reused a stale narrower plan, silently dropping
rows or truncating values (300 bound as 44, Refs #57). Aggregate
element signatures across the whole list (max int width, merged struct
fields), mirroring C++ tryGetMaxLogicalType; homogeneous int lists
still key as INT64 like pyHomogeneousListType.
@adsharma
adsharma marked this pull request as ready for review October 1, 2026 01:19
@adsharma
adsharma merged commit 548c183 into main Oct 1, 2026
2 checks passed
@adsharma
adsharma deleted the issue-57 branch October 1, 2026 01:20
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.

execute(query, params): cached statement silently drops/truncates rows when a list-of-struct param needs a wider int type

1 participant