You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Fokko (via GitHub)" <gi...@apache.org> on 2023/06/06 16:08:34 UTC

[GitHub] [arrow] Fokko commented on a diff in pull request #35568: GH-33986: [Python] Sketch out a minimal protocol interface for datasets

Fokko commented on code in PR #35568:
URL: https://github.com/apache/arrow/pull/35568#discussion_r1219922212


##########
docs/source/python/integration/dataset.rst:
##########
@@ -0,0 +1,90 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+.. currentmodule:: pyarrow.dataset
+
+Extending PyArrow Datasets
+==========================
+
+PyArrow provides a core protocol for datasets, so third-party libraries can both
+produce and consume PyArrow datasets.
+
+Dataset Producers
+-----------------
+
+If you are a library implementing a new data source, you'll want to be able to
+produce a PyArrow-compatible dataset. Your dataset could be backed by the classes
+implemented in PyArrow or you could implement your own classes. Either way, you
+should implement the protocol below.
+
+When implementing the dataset, consider the following:
+
+* To scale to very large dataset, don't eagerly load all the fragments into memory.
+  Instead, load fragments once a filter is passed. This allows you to skip loading
+  metadata about fragments that aren't relevant to queries. For example, if you
+  have a dataset that uses Hive-style paritioning for a column ``date`` and the
+  user passes a filter for ``date=2023-01-01``, then you can skip listing directory
+  for HIVE partitions that don't match that date.
+* Filters passed down should be fully executed. While other systems have scanners
+  that are "best-effort", only executing the parts of the filter that it can, PyArrow
+  datasets should always remove all rows that don't match the filter.

Review Comment:
   It would be nice if we can control this. In Iceberg we know if there are any residuals in the file.



##########
docs/source/python/integration/dataset.rst:
##########
@@ -0,0 +1,90 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+.. currentmodule:: pyarrow.dataset
+
+Extending PyArrow Datasets
+==========================
+
+PyArrow provides a core protocol for datasets, so third-party libraries can both
+produce and consume PyArrow datasets.
+
+Dataset Producers
+-----------------
+
+If you are a library implementing a new data source, you'll want to be able to
+produce a PyArrow-compatible dataset. Your dataset could be backed by the classes
+implemented in PyArrow or you could implement your own classes. Either way, you
+should implement the protocol below.
+
+When implementing the dataset, consider the following:
+
+* To scale to very large dataset, don't eagerly load all the fragments into memory.
+  Instead, load fragments once a filter is passed. This allows you to skip loading
+  metadata about fragments that aren't relevant to queries. For example, if you
+  have a dataset that uses Hive-style paritioning for a column ``date`` and the
+  user passes a filter for ``date=2023-01-01``, then you can skip listing directory
+  for HIVE partitions that don't match that date.

Review Comment:
   Is this relevant to the protocol? For context: In Iceberg you can just pass in an expression, and it automatically checks if the partitioning can be used to prune any data. Iceberg is lazy, so multiple partitioning strategies can co-exist because it changed over time (you never know how the partitions evolve over time, so this should be flexible :).



-- 
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