Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bigframes/bigquery/_operations/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def _to_sql(df_or_sql: Union[pd.DataFrame, dataframe.DataFrame, str]) -> str:
else:
bf_df = cast(dataframe.DataFrame, df_or_sql)

# Cache dataframes to make sure base table is not a snapshot.
# Cached dataframe creates a full copy, never uses snapshot.
# This is a workaround for internal issue b/310266666.
bf_df.cache()
sql, _, _ = bf_df._to_sql_query(include_index=False)
return sql

Expand Down
5 changes: 3 additions & 2 deletions bigframes/ml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,9 @@ def create_model(
Returns: a BqmlModel, wrapping a trained model in BigQuery
"""
options = dict(options)
# Cache dataframes to make sure base table is not a snapshot
# cached dataframe creates a full copy, never uses snapshot
# Cache dataframes to make sure base table is not a snapshot.
# Cached dataframe creates a full copy, never uses snapshot.
# This is a workaround for internal issue b/310266666.
if y_train is None:
input_data = X_train.reset_index(drop=True).cache()
else:
Expand Down