[ 
https://issues.apache.org/jira/browse/ARROW-8221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17229957#comment-17229957
 ] 

Joris Van den Bossche commented on ARROW-8221:
----------------------------------------------

[~westonpace] do you have an example? Normally, missing columns in one of the 
files is something that should be supported already (they get filled with 
nulls).

{code}
In [1]: table = pa.table({'a': [1, 2, 3]})

In [2]: import pyarrow.dataset as ds

In [3]: ds.write_dataset(table, "test_columns", format="parquet")

In [6]: ds.dataset("test_columns").to_table().to_pandas()
Out[6]: 
   a
0  1
1  2
2  3

In [7]: ds.dataset("test_columns", schema=pa.schema([('a', 'int64'), ('b', 
'float64')])).to_table().to_pandas()
Out[7]: 
   a   b
0  1 NaN
1  2 NaN
2  3 NaN
{code}

> [Python][Dataset] Expose schema inference / validation options in the factory
> -----------------------------------------------------------------------------
>
>                 Key: ARROW-8221
>                 URL: https://issues.apache.org/jira/browse/ARROW-8221
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Assignee: Joris Van den Bossche
>            Priority: Major
>              Labels: dataset
>             Fix For: 3.0.0
>
>
> ARROW-8058 added options related to schema inference / validation for the 
> Dataset factory. We should expose this in Python in the {{dataset(..)}} 
> factory function:
> - Add ability to pass a user-specified schema with a {{schema}} keyword, 
> instead of inferring the schema from (one of) the files (to be passed to the 
> factory finish method)
> - Add {{validate_schema}} option to toggle whether the schema is validated 
> against the actual files or not.
> - Expose in some way the number of fragments to be inspected when inferring 
> or validating the schema. Not sure yet what the best API for this would be. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to