GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Optimize SQL entity handling without creating temporary tables … · Marcus-Rosti/feast@aa2c838

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • sdk/python/feast/infra/offline_stores/contrib/trino_offline_store
    • trino.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/trino.py‎

Copy file name to clipboardExpand all lines: sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/trino.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ def get_historical_features(
372372
)
373373

374374
# Generate the Trino SQL query from the query context
375+
if type(entity_df) is str:
376+
table_reference = f"({entity_df})"
375377
query = offline_utils.build_point_in_time_query(
376378
query_context,
377379
left_table_query_string=table_reference,
@@ -454,9 +456,7 @@ def _upload_entity_df_and_get_entity_schema(
454456
) -> Dict[str, np.dtype]:
455457
"""Uploads a Pandas entity dataframe into a Trino table and returns the resulting table"""
456458
if type(entity_df) is str:
457-
client.execute_query(f"CREATE TABLE {table_name} AS ({entity_df})")
458-
459-
results = client.execute_query(f"SELECT * FROM {table_name} LIMIT 1")
459+
results = client.execute_query(f"SELECT * FROM ({entity_df}) LIMIT 1")
460460

461461
limited_entity_df = pd.DataFrame(
462462
data=results.data, columns=results.columns_names

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.