[
https://issues.apache.org/jira/browse/ARROW-7662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17022274#comment-17022274
]
Neal Richardson commented on ARROW-7662:
----------------------------------------
This logic would go in
https://github.com/apache/arrow/blob/dd6b17d/r/src/array_from_vector.cpp#L871.
I think you'd have to iterate over the list and call InferType on each element,
and if they were all the same type, you could construct a ListType of that type
(cf.
https://github.com/apache/arrow/blob/dd6b17d0cc1a77aaff84c5a4472ac73bc79486af/r/R/list.R#L30).
If they weren't all the same, there's probably a way to represent that in
Arrow, but you could also just bail out like it does now; getting the uniform
list type supported would probably solve most use cases.
Would you be interested in submitting a PR?
> [R] Support auto-inferring list column type
> -------------------------------------------
>
> Key: ARROW-7662
> URL: https://issues.apache.org/jira/browse/ARROW-7662
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Reporter: Michael Chirico
> Priority: Major
>
> {code:r}
> DF = data.frame(a = 1:10)
> DF$b = as.list(DF$a)
> arrow::write_parquet(DF, 'test.parquet')
> # Error in Table__from_dots(dots, schema) : cannot infer type from data
> {code}
> This appears to be supported naturally already in Python:
> {code:python}
> import pandas as pd
> pd.DataFrame({'a': [1, 2, 3], 'b': [[1, 2], [3, 4], [5,
> 6]]}).to_parquet('test.parquet')
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)