Skip to content

Commit f4c114e

Browse files
authored
support pyarrow 20 (#7540)
* support pyarrow 20 * update tests
1 parent ba451d1 commit f4c114e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/datasets/features/features.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def to_numpy(self, zero_copy_only=True):
798798

799799
return numpy_arr
800800

801-
def to_pylist(self):
801+
def to_pylist(self, maps_as_pydicts: Optional[Literal["lossy", "strict"]] = None):
802802
zero_copy_only = _is_zero_copy_only(self.storage.type, unnest=True)
803803
numpy_arr = self.to_numpy(zero_copy_only=zero_copy_only)
804804
if self.type.shape[0] is None and numpy_arr.dtype == object:

tests/test_hub.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_convert_to_parquet(temporary_repo, hf_api, hf_token, ci_hub_config, ci_
8484
- name: train
8585
num_bytes: 55
8686
num_examples: 5
87-
download_size: 717
87+
download_size: 725
8888
dataset_size: 55
8989
{METADATA_CONFIGS_FIELD}:
9090
- config_name: first
@@ -105,7 +105,7 @@ def test_convert_to_parquet(temporary_repo, hf_api, hf_token, ci_hub_config, ci_
105105
- name: train
106106
num_bytes: 60
107107
num_examples: 5
108-
download_size: 723
108+
download_size: 731
109109
dataset_size: 60
110110
{METADATA_CONFIGS_FIELD}:
111111
- config_name: second
@@ -115,6 +115,9 @@ def test_convert_to_parquet(temporary_repo, hf_api, hf_token, ci_hub_config, ci_
115115
---
116116
"""),
117117
]
118+
if PYARROW_VERSION < version.parse("20.0.0"):
119+
expected_readmes[0] = expected_readmes[0].replace("download_size: 725", "download_size: 717")
120+
expected_readmes[1] = expected_readmes[1].replace("download_size: 731", "download_size: 723")
118121
if PYARROW_VERSION < version.parse("18.1.0"):
119122
expected_readmes[0] = expected_readmes[0].replace("download_size: 717", "download_size: 726")
120123
expected_readmes[1] = expected_readmes[1].replace("download_size: 723", "download_size: 732")

0 commit comments

Comments
 (0)