fix(trino): Clean up temporary entity tables after retrieval#6381
Open
Jwrede wants to merge 1 commit intofeast-dev:masterfrom
Open
fix(trino): Clean up temporary entity tables after retrieval#6381Jwrede wants to merge 1 commit intofeast-dev:masterfrom
Jwrede wants to merge 1 commit intofeast-dev:masterfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TrinoOfflineStore.get_historical_features()creates a temporary table(
feast_entity_df_<uuid>) for the entity DataFrame but never drops it,leaking tables in the Trino catalog indefinitely.
This applies the same context manager pattern already used by the
BigQuery, Redshift, and Athena offline stores: wrap the query in a
generator that issues
DROP TABLE IF EXISTSin afinallyblock.The cleanup only runs when the entity_df is a DataFrame (when a temp
table was actually created), not when it is a SQL string.
Fixes #6306
How Has This Been Tested?
(
bigquery.py:304), Redshift (redshift.py:236), and Athena(
athena.py:224).TrinoRetrievalJobthat pass a plain query string(e.g.
pull_latest_from_table_or_query) continue to work via thefallback
contextmanagerwrapper.