You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/24 04:07:29 UTC
[GitHub] [arrow] phpsxg opened a new issue, #14725: How to partition by quantity with write_to_dataset
phpsxg opened a new issue, #14725:
URL: https://github.com/apache/arrow/issues/14725
### Describe the usage question you have. Please include as many useful details as possible.
**write_to_dataset** partition by field, error is reported: **pyarrow.lib.ArrowInvalid: Fragment would be written into 32768 partitions. This exceeds the maximum of 1024,** is there a better way to partition ? Or can it be partitioned by quantity? Thanks
```
pq.write_to_dataset(table,
root_path=file_path,
partition_cols=cls.partition_cols,
existing_data_behavior='delete_matching',
use_legacy_dataset=False
)
```
- python=3.10
- pyarrow=10.0.0
### Component
Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to partition by quantity with write_to_dataset [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #14725:
URL: https://github.com/apache/arrow/issues/14725#issuecomment-3547070973
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this usage question has evolved into a feature request or docs update, please remove the 'Type: usage' label and add the 'Type: enhancement' label instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to partition by quantity with write_to_dataset [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic closed issue #14725: How to partition by quantity with write_to_dataset
URL: https://github.com/apache/arrow/issues/14725
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] phpsxg commented on issue #14725: How to partition by quantity with write_to_dataset
Posted by GitBox <gi...@apache.org>.
phpsxg commented on issue #14725:
URL: https://github.com/apache/arrow/issues/14725#issuecomment-1327188431
> Without knowing what your data looks like it is hard to say how to better partition it. But you can raise the maximum number of partitions via `max_partitions` which defaults to 1024 or you could just limit the number of rows per file if you don't have a more specific partitioning scheme with `max_rows_per_file`: https://arrow.apache.org/docs/python/generated/pyarrow.dataset.write_dataset.html#pyarrow.dataset.write_dataset
>
> Feel free to close the issue if this answers your question.
Thank you, ds.write_dataset meets my needs, but I have two more questions
1. Is there any difference between **pq.write_to_dataset** and **ds.write_dataset**?
2. How to implement dynamic filtering with ds.write_dataset, if the filters I get according to different parameters are a list
For example, there are two filters, which is fine
`df = dataset.to_table(filter=( ds.field('c').is_null()) & (ds.field('b') > 0)).to_pandas()`
But if the filter is a list, how to pass the parameters
```
filters = []
if ...:
filters.append(ds.field('c').is_null())
if ....:
filters.append(ds.field('b') > 0)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] How to partition by quantity with write_to_dataset [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic closed issue #14725: How to partition by quantity with write_to_dataset
URL: https://github.com/apache/arrow/issues/14725
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] westonpace commented on issue #14725: How to partition by quantity with write_to_dataset
Posted by GitBox <gi...@apache.org>.
westonpace commented on issue #14725:
URL: https://github.com/apache/arrow/issues/14725#issuecomment-1327000465
We typically operate in batches of size 32768. So if you are getting that message it means you are trying to partition on a column that has a different value for every single row! As @assignUser pointed out, you can increase `max_partitions` to support that but this is probably a sign that you are not picking a good partition column. What is the data type of the column you are trying to partition on?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] assignUser commented on issue #14725: How to partition by quantity with write_to_dataset
Posted by GitBox <gi...@apache.org>.
assignUser commented on issue #14725:
URL: https://github.com/apache/arrow/issues/14725#issuecomment-1326466314
Without knowing what your data looks like it is hard to say how to better partition it. But you can raise the maximum number of partitions via `max_partitions` which defaults to 1024 or you could just limit the number of rows per file if you don't have a more specific partitioning scheme with `max_rows_per_file`:
https://arrow.apache.org/docs/python/generated/pyarrow.dataset.write_dataset.html#pyarrow.dataset.write_dataset
Feel free to close the issue if this answers your question.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org