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
8 changes: 6 additions & 2 deletions bigframes/session/bq_caching_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,18 @@ def _execute_plan_gbq(

create_table = True
if not cache_spec.cluster_cols:
assert len(cache_spec.cluster_cols) <= _MAX_CLUSTER_COLUMNS
offsets_id = bigframes.core.identifiers.ColumnId(
bigframes.core.guid.generate_guid()
)
plan = nodes.PromoteOffsetsNode(plan, offsets_id)
cluster_cols = [offsets_id.sql]
else:
cluster_cols = cache_spec.cluster_cols
cluster_cols = [
col
for col in cache_spec.cluster_cols
if bigframes.dtypes.is_clusterable(plan.schema.get_type(col))
]
cluster_cols = cluster_cols[:_MAX_CLUSTER_COLUMNS]

compiled = compile.compile_sql(
compile.CompileRequest(
Expand Down
17 changes: 17 additions & 0 deletions tests/system/small/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5537,6 +5537,23 @@ def test_df_cached(scalars_df_index):
pandas.testing.assert_frame_equal(df.to_pandas(), df_cached_copy.to_pandas())


def test_df_cached_many_index_cols(scalars_df_index):
index_cols = [
"int64_too",
"time_col",
"int64_col",
"bool_col",
"date_col",
"timestamp_col",
"string_col",
]
df = scalars_df_index.set_index(index_cols)
df = df[df["rowindex_2"] % 2 == 0]

df_cached_copy = df.cache()
pandas.testing.assert_frame_equal(df.to_pandas(), df_cached_copy.to_pandas())


def test_assign_after_binop_row_joins():
pd_df = pd.DataFrame(
{
Expand Down