Repository navigation
Conversation
…base functionality)
…adata parsing I suppose
|
cc @jcrist - Do you think it would be useful to use something like this to explore better defaults/algorithms for |
|
@jorisvandenbossche - It looks like there are two things missing from
Am I correct that these features are missing? If so, I can file issues in Jira |
I think we only discussed that previously on github (apache/arrow#10991 (comment)), but based on a quick search there isn't yet a JIRA about it (but it has been in the back of my head to try to plan this for the next release)
The |
Right - I don't get import pyarrow as pa
import pyarrow.dataset as ds
import pyarrow.orc as pa_orc
print("PyArrow Version:", pa.__version__)
table = pa.table([
pa.array([1, 2]),
pa.array(["a", "b"])
], names=["int", "str"])
path = "myfile.orc"
pa_orc.write_table(table, path)
dataset = ds.dataset(path, format="orc")
fragments = list(dataset.get_fragments())
fragments[0].pathOutput: Should I be using a different API here? |
|
Ah, yes, that's a bug / oversight in the ORC dataset bindings, the fragments should also return FileFragments instead of the base class Fragments. Opened https://issues.apache.org/jira/browse/ARROW-16442 and apache/arrow#13052 PR to fix it. |
WARNING: Very much a WIP - Do not merge!
This PR adds an experimental
from_datasetAPI for reading general on-disk tabular data into a Dask-DataFrame collection. This PR only adds engines based on thepyarrow.datasetAPI, but they already support Parquet, ORC, Feather / Arrow IPC, and CSV (and other engines can certainly be added). My primary goal is to come up with a single scalable design for tabular data formats like Parquet. I am hoping to use this code base as a "sandbox" for exploring the best default settings and algorithms for reading formats like Parquet.One possible (but far-off) outcome of this work is that the current
read_parquetimplementation could be refactored to simply callfrom_dataset. However, such a move would require us to (1) revise/simplify default arguments and features in read_parquet until they are aligned with those in from_dataset, and (2) ultimately deprecate the existing Engine classes used indd.io.parquet(no small task).So... Why not just explore defaults and algorithms in the existing
read_parquetcode?The simple answer to this is that the current
read_parquetdesign is no-longer well-suited for theEngineclasses it is meant to support. When the "pluggable"Enginedesign was first implemented (nearly three years ago), there was nopyarrow.datasetAPI, and even cudf and fastparquet had very different features and limitations. For example, at the time, none of the Engines supported row-group or row-wise filtering, and so the engine-agnosticread_parquetcode was written in a way that is inefficient when the engine actual can take care of file/row-group filtering. Another “pain point” is that requiring the Engine to expose multiple “static”/“class” methods requires a giant dictionary of options to be passed all over the code base (creating an apparent “spaghetti code” situation).In contrast to the current
read_parquetorganization, I think it makes a lot more sense for theEngineto operate as an “object” (not as a class), and for the engine-agnostic code to simply ask the engine to return everything it needs to generate the new collection (an IO function, meta, a list of IO-function inputs, and divisions). This way, all engine-specific options can be clearly documented and validated at the engine level, and the engine can use temporary “state” to avoid passing around a laundry-list of options everywhere.To clarify, I propose that the top-level function only support a very limited set of options. In fact, I don’t believe that the engine-agnostic code should do any path/filesystem handling at all. The top-level API should only include a minimum set of common options (and the engine can still raise an error for something like
calculate_divisions=Truefor formats without min/max statistics support):For example, the current (still in flux) docstring is: