Skip to content

Commit 25bc354

Browse files
authored
fix empty dataset to_parquet (#7779)
fix empty dataset
1 parent bd6b888 commit 25bc354

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/datasets/arrow_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def get_writer_batch_size_from_data_size(num_rows: int, num_bytes: int) -> int:
151151
writer_batch_size (`Optional[int]`):
152152
Writer batch size to pass to a parquet writer.
153153
"""
154-
return max(10, num_rows * convert_file_size_to_int(config.MAX_ROW_GROUP_SIZE) // num_bytes)
154+
return max(10, num_rows * convert_file_size_to_int(config.MAX_ROW_GROUP_SIZE) // num_bytes) if num_bytes > 0 else 1
155155

156156

157157
class SchemaInferenceError(ValueError):

0 commit comments

Comments
 (0)