File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -2426,14 +2426,12 @@ def to_sql_query(
2426
2426
def cached (self , * , force : bool = False , session_aware : bool = False ) -> None :
2427
2427
"""Write the block to a session table."""
2428
2428
# use a heuristic for whether something needs to be cached
2429
- if (not force ) and self .session ._executor ._is_trivially_executable (self .expr ):
2430
- return
2431
- elif session_aware :
2432
- self .session ._executor ._cache_with_session_awareness (self .expr )
2433
- else :
2434
- self .session ._executor ._cache_with_cluster_cols (
2435
- self .expr , cluster_cols = self .index_columns
2436
- )
2429
+ self .session ._executor .cached (
2430
+ self .expr ,
2431
+ force = force ,
2432
+ use_session = session_aware ,
2433
+ cluster_cols = self .index_columns ,
2434
+ )
2437
2435
2438
2436
def _is_monotonic (
2439
2437
self , column_ids : typing .Union [str , Sequence [str ]], increasing : bool
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ def __init__(
94
94
bqclient : bigquery .Client ,
95
95
storage_manager : bigframes .session .temp_storage .TemporaryGbqStorageManager ,
96
96
bqstoragereadclient : google .cloud .bigquery_storage_v1 .BigQueryReadClient ,
97
+ * ,
97
98
strictly_ordered : bool = True ,
98
99
metrics : Optional [bigframes .session .metrics .ExecutionMetrics ] = None ,
99
100
):
@@ -354,6 +355,23 @@ def get_row_count(self, array_value: bigframes.core.ArrayValue) -> int:
354
355
iter , _ = self ._run_execute_query (sql )
355
356
return next (iter )[0 ]
356
357
358
+ def cached (
359
+ self ,
360
+ array_value : bigframes .core .ArrayValue ,
361
+ * ,
362
+ force : bool = False ,
363
+ use_session : bool = False ,
364
+ cluster_cols : Sequence [str ] = (),
365
+ ) -> None :
366
+ """Write the block to a session table."""
367
+ # use a heuristic for whether something needs to be cached
368
+ if (not force ) and self ._is_trivially_executable (array_value ):
369
+ return
370
+ elif use_session :
371
+ self ._cache_with_session_awareness (array_value )
372
+ else :
373
+ self ._cache_with_cluster_cols (array_value , cluster_cols = cluster_cols )
374
+
357
375
def _local_get_row_count (
358
376
self , array_value : bigframes .core .ArrayValue
359
377
) -> Optional [int ]:
You can’t perform that action at this time.
0 commit comments