Skip to content
Merged
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
12 changes: 10 additions & 2 deletions python/dask_cudf/dask_cudf/_legacy/io/parquet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
import contextlib
import itertools
import warnings
from functools import partial
Expand All @@ -22,6 +23,7 @@
from cudf.core.column import CategoricalColumn, as_column
from cudf.io import write_to_dataset
from cudf.io.parquet import _apply_post_filters, _normalize_filters
from cudf.utils import ioutils
from cudf.utils.dtypes import cudf_dtype_from_pa_type


Expand Down Expand Up @@ -348,8 +350,14 @@ def write_partition(
storage_options=kwargs.get("storage_options", None),
)
else:
with fs.open(fs.sep.join([path, filename]), mode="wb") as out_file:
if not isinstance(out_file, IOBase):
with (
contextlib.nullcontext()
if ioutils._is_local_filesystem(fs)
else fs.open(fs.sep.join([path, filename]), mode="wb")
) as out_file:
if out_file is None:
out_file = fs.sep.join([path, filename])
elif not isinstance(out_file, IOBase):
out_file = BufferedWriter(out_file)
Comment on lines +360 to 361
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ayushdg - I think we can remove this block? Do you remember why BufferedWriter was needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recall unfortunately.

md = df.to_parquet(
path=out_file,
Expand Down
Loading