Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: use random table for read_pandas
  • Loading branch information
ashleyxuu committed Nov 10, 2023
commit a436194957f4fa41c979aef8bd19164d4a3ea8dc
2 changes: 1 addition & 1 deletion bigframes/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def cached(self, cluster_cols: typing.Sequence[str]) -> ArrayValue:
ibis_expr = compiled_value._to_ibis_expr(
ordering_mode="unordered", expose_hidden_cols=True
)
tmp_table = self.session._ibis_to_session_table(
tmp_table = self.session._ibis_to_temp_table(
ibis_expr, cluster_cols=cluster_cols, api_name="cached"
)

Expand Down
14 changes: 3 additions & 11 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
Tuple,
Union,
)
import uuid
import warnings

import google.api_core.client_info
Expand Down Expand Up @@ -977,7 +976,7 @@ def _read_pandas(
job_config.clustering_fields = cluster_cols
job_config.labels = {"bigframes-api": api_name}

load_table_destination = self._create_session_table()
load_table_destination = bigframes_io.random_table(self._anonymous_dataset)
load_job = self.bqclient.load_table_from_dataframe(
pandas_dataframe_copy,
load_table_destination,
Comment thread
ashleyxuu marked this conversation as resolved.
Expand Down Expand Up @@ -1269,13 +1268,6 @@ def _check_file_size(self, filepath: str):
"for large files to avoid loading the file into local memory."
)

def _create_session_table(self) -> bigquery.TableReference:
table_name = f"{uuid.uuid4().hex}"
dataset = bigquery.Dataset(
bigquery.DatasetReference(self.bqclient.project, "_SESSION")
)
return dataset.table(table_name)

def _create_empty_temp_table(
self,
schema: Iterable[bigquery.SchemaField],
Expand Down Expand Up @@ -1310,7 +1302,7 @@ def _create_sequential_ordering(
ibis.row_number().cast(ibis_dtypes.int64).name(default_ordering_name)
)
table = table.mutate(**{default_ordering_name: default_ordering_col})
table_ref = self._ibis_to_session_table(
table_ref = self._ibis_to_temp_table(
table,
cluster_cols=list(index_cols) + [default_ordering_name],
api_name=api_name,
Expand All @@ -1326,7 +1318,7 @@ def _create_sequential_ordering(
)
return table, ordering

def _ibis_to_session_table(
def _ibis_to_temp_table(
self,
table: ibis_types.Table,
cluster_cols: Iterable[str],
Expand Down