Commit 78fcd72
fix(trino): Clean up temporary entity tables after retrieval (feast-dev#6381)
* fix(trino): Clean up temporary entity tables after retrieval
TrinoOfflineStore.get_historical_features() creates a temporary table
for the entity DataFrame but never drops it, leaking tables
indefinitely. Apply the same context manager pattern used by
BigQuery, Redshift, and Athena offline stores: wrap the query in a
generator that issues DROP TABLE IF EXISTS in a finally block.
Fixes feast-dev#6306
Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
* fix: sort imports for ruff compliance
Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
* fix: decouple temp table cleanup from query access
Avoid dropping the temporary entity table on to_sql() calls.
Previously, every method used a context manager that dropped
the table on exit, so calling to_sql() before to_df() would
destroy the table and cause subsequent queries to fail.
Now the query is stored as a plain string and cleanup is
handled by a dedicated _drop_temp_table() method called only
after query execution (to_df, to_trino). A __del__ fallback
ensures cleanup if execution methods are never called. The
_cleaned_up flag makes the drop idempotent.
Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
---------
Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
Signed-off-by: RutujaPathade <73137503+RutujaPathade@users.noreply.github.com>1 parent de050ab commit 78fcd72
1 file changed
Lines changed: 45 additions & 10 deletions
Lines changed: 45 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
4 | 13 | | |
5 | 14 | | |
6 | 15 | | |
| |||
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| 49 | + | |
| 50 | + | |
40 | 51 | | |
41 | 52 | | |
42 | 53 | | |
| |||
183 | 194 | | |
184 | 195 | | |
185 | 196 | | |
| 197 | + | |
186 | 198 | | |
187 | 199 | | |
188 | 200 | | |
189 | 201 | | |
190 | 202 | | |
191 | 203 | | |
192 | 204 | | |
| 205 | + | |
| 206 | + | |
193 | 207 | | |
194 | 208 | | |
195 | 209 | | |
| |||
199 | 213 | | |
200 | 214 | | |
201 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
202 | 231 | | |
203 | 232 | | |
204 | | - | |
205 | | - | |
206 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
207 | 239 | | |
208 | 240 | | |
209 | 241 | | |
| |||
234 | 266 | | |
235 | 267 | | |
236 | 268 | | |
237 | | - | |
238 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
239 | 274 | | |
240 | 275 | | |
241 | 276 | | |
| |||
372 | 407 | | |
373 | 408 | | |
374 | 409 | | |
| 410 | + | |
375 | 411 | | |
376 | | - | |
| 412 | + | |
377 | 413 | | |
378 | 414 | | |
379 | | - | |
| 415 | + | |
380 | 416 | | |
381 | 417 | | |
382 | 418 | | |
| |||
385 | 421 | | |
386 | 422 | | |
387 | 423 | | |
| 424 | + | |
388 | 425 | | |
389 | 426 | | |
390 | 427 | | |
| |||
483 | 520 | | |
484 | 521 | | |
485 | 522 | | |
486 | | - | |
487 | | - | |
488 | 523 | | |
489 | 524 | | |
490 | 525 | | |
| |||
0 commit comments