Skip to content

Commit 93785cb

Browse files
fix: Fix unordered mode using ordered path to print frame (#839)
1 parent 4e7e67b commit 93785cb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bigframes/core/blocks.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def to_pandas(
498498
sampling_method: Optional[str] = None,
499499
random_state: Optional[int] = None,
500500
*,
501-
ordered: bool = True,
501+
ordered: Optional[bool] = None,
502502
) -> Tuple[pd.DataFrame, bigquery.QueryJob]:
503503
"""Run query and download results as a pandas DataFrame."""
504504
if (sampling_method is not None) and (sampling_method not in _SAMPLING_METHODS):
@@ -517,7 +517,10 @@ def to_pandas(
517517

518518
df, query_job = self._materialize_local(
519519
materialize_options=MaterializationOptions(
520-
downsampling=sampling, ordered=ordered
520+
downsampling=sampling,
521+
ordered=ordered
522+
if ordered is not None
523+
else self.session._strictly_ordered,
521524
)
522525
)
523526
df.set_axis(self.column_labels, axis=1, copy=False)

tests/system/small/test_unordered.py

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ def test_unordered_mode_cache_aggregate(unordered_session):
3131
assert_pandas_df_equal(bf_result, pd_result, ignore_order=True)
3232

3333

34+
def test_unordered_mode_print(unordered_session):
35+
pd_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, dtype=pd.Int64Dtype())
36+
df = bpd.DataFrame(pd_df, session=unordered_session).cache()
37+
print(df)
38+
39+
3440
@skip_legacy_pandas
3541
def test_unordered_mode_read_gbq(unordered_session):
3642
df = unordered_session.read_gbq(

0 commit comments

Comments
 (0)