[Python][Parquet] Improve usability of ParquetDataset
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 17.1k
- Fork
- 4.3k
- Merge trung bình
- 3 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 100
Mô tả
In e.g. pd.read_parquet implementation, we currently wrap pq.read_table. However, I would like to use the dataset implementation to get access to some more features (e.g. reading only the first few rows, defining a filter after opening (discovering the schema) the dataset).
That runs into some issues:
pq.read_table()uses ParquetDataset under the hood, but still has a fallback to plainParquetFile().read()whenpyarrow.datasetmodule is not available. While this will definitely be uncommon, I have no clue how important it is to keep supporting this (also on the pandas side, since this is currently a "feature" ofpandas.read_parquetby means of usingpq.read_table).- I would prefer using
pq.ParquetDatasetoverpyarrow.dataset, because the parquet version is compatible withpq.read_tableand does all the translation to thepyarrow.datasetAPI for us (constructing the file format object, passing the various keywords in the correct place, mapping some naming differences, etc) - But
ParquetDatasetis also limited, and currently I am essentially using it as a constructor to then access the underlying._dataset(thepyarrow.datasetdataset object)
Some ideas that I was having:
- Add a new
pq.open_dataset()-like function that also has the boilerplate to construct thepyarrow.datasetobject, but returns that instead of theParquetDatasetwrapper - Would it be technically possible to let
pq.ParquetDatasetinherit frompyarrow.dataset.Dataset, so you get those methods that way, while keeping it back-compat - Add new methods to
pq.ParquetDataset(to_table(),head(), etc) to make it look more like apyarrow.dataset.Dataset, but without actually inheriting from it - Simply "officially" expose the underlying dataset, so that I don't have to use the private
_datasetattribute
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng việc xem xét sự tích hợp của pandas.read_parquet và pq.read_table, sau đó kiểm tra pq.ParquetDataset và _dataset bên dưới của nó cùng với API pyarrow.dataset. So sánh hàm open_dataset được đề xuất, tính kế thừa, các phương thức được thêm vào và việc công khai dataset; hoàn thành có nghĩa là lựa chọn và ghi lại một hướng khả dụng tương thích với phạm vi API phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- data-engineering
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100