-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ArrayXD YAML conversion #6168
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
Show benchmarksPyArrow==8.0.0 Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
|
Maybe convert all the tuples by default instead of hardcoding a logic specific to ArrayXD ? |
@mariosasko Have you been able to fix this issue ? we're having quite a rough time updating our dataset lately |
@lhoestq Does it look good now? |
def to_yaml_types(obj: dict) -> dict: | ||
if isinstance(obj, dict): | ||
return {k: to_yaml_types(v) for k, v in obj.items()} | ||
elif isinstance(obj, list): | ||
return [to_yaml_types(v) for v in obj] | ||
elif isinstance(obj, tuple): | ||
return to_yaml_types(list(obj)) | ||
else: | ||
return obj | ||
|
||
return to_yaml_types(to_yaml_inner(yaml_data)["struct"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed ?
def to_yaml_types(obj: dict) -> dict: | |
if isinstance(obj, dict): | |
return {k: to_yaml_types(v) for k, v in obj.items()} | |
elif isinstance(obj, list): | |
return [to_yaml_types(v) for v in obj] | |
elif isinstance(obj, tuple): | |
return to_yaml_types(list(obj)) | |
else: | |
return obj | |
return to_yaml_types(to_yaml_inner(yaml_data)["struct"]) | |
return to_yaml_inner(yaml_data)["struct"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to_yaml_inner
doesn't traverse the leaves (attributes) of the complex types (Image
, ArrayXD
, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !
Show benchmarksPyArrow==8.0.0 Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
Show updated benchmarks!Benchmark: benchmark_array_xd.json
Benchmark: benchmark_getitem_100B.json
Benchmark: benchmark_indices_mapping.json
Benchmark: benchmark_iterating.json
Benchmark: benchmark_map_filter.json
|
Replace the
shape
tuple with a list in theArrayXD
YAML conversion.Fix #6112