c21 commented on code in PR #7148:
URL: https://github.com/apache/iceberg/pull/7148#discussion_r1145289777
##########
python/pyiceberg/table/__init__.py:
##########
@@ -415,3 +416,8 @@ def to_duckdb(self, table_name: str, connection:
Optional[DuckDBPyConnection] =
con.register(table_name, self.to_arrow())
return con
+
+ def to_ray(self) -> ray.data.dataset.Dataset:
+ import ray
+
+ return ray.data.from_arrow(self.to_arrow())
Review Comment:
It looks like `self.to_arrow()` will eventually call [`pq.read_table()` to
read the table into memory (with optionally row filtering and columns
pruning)](https://github.com/apache/iceberg/blob/d6e258120d86de791fd7363391c0301ba5c39ae3/python/pyiceberg/io/pyarrow.py#L520-L527)
(`to_arrow` -> `project_table` -> `_file_to_table` -> `pq.read_table`).
Ray also leverages PyArrow dataset to read a variety of format (Parquet,
CSV, etc) ([API
list](https://docs.ray.io/en/releases-2.3.0/data/api/input_output.html)). And
internally Ray uses PyArrow to read data in batches and in parallel with many
tasks.
This PR is a good starting point. We can further collaborate to add a
`read_iceberg()` API in Ray, to implement a [custom data
source](https://docs.ray.io/en/latest/data/custom-datasource.html) for Iceberg,
so it can do the parallel read and be scalable.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]