Commit c4dc58b
committed
fix: add schema fingerprint to pointer cache key for in-place mutation safety
Include a schema fingerprint (shape + column names + dtypes for pandas,
field names + types for pyarrow/polars) in the prepared-statement cache
key for pointer-type parameters. Without this, mutating a DataFrame
in place between execute() calls (e.g. df.drop(columns=[...],
inplace=True)) would reuse the cached prepared statement compiled for
the original schema, causing data corruption.
The cache key tuple expands from 4 to 5 elements:
("pointer", module, type_name, gen) -> ("pointer", module, type_name, gen, schema_fp)
The fingerprint is computed fresh on every call; two objects with the
same identity and schema share the cache entry, while schema mutations
produce a different key and trigger a fresh prepare.1 parent 93fd1d7 commit c4dc58b
1 file changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
131 | 156 | | |
132 | 157 | | |
133 | 158 | | |
| |||
188 | 213 | | |
189 | 214 | | |
190 | 215 | | |
| 216 | + | |
191 | 217 | | |
192 | 218 | | |
193 | 219 | | |
194 | 220 | | |
195 | | - | |
| 221 | + | |
196 | 222 | | |
197 | 223 | | |
198 | 224 | | |
199 | 225 | | |
200 | 226 | | |
201 | 227 | | |
202 | 228 | | |
203 | | - | |
| 229 | + | |
204 | 230 | | |
205 | 231 | | |
206 | 232 | | |
| |||
0 commit comments