Closed lgaborini closed 3 months ago
This is an arrow
issue, not a targets
issue:
data <- tibble::tibble(
x = list(
factor(c("a", "b"), levels = c("c", "b", "a"), ordered = TRUE),
factor(c("b", "c"), levels = c("c", "b", "a"), ordered = TRUE)
)
)
arrow::write_parquet(data, tempfile())
#> Error: Invalid: Column data for field 0 with type list<item: dictionary<values=string, indices=int8, ordered=0>> is inconsistent with schema list<item: dictionary<values=string, indices=int8, ordered=1>>
Created on 2024-05-30 with reprex v2.1.0
Please file this as a bug report at https://github.com/apache/arrow/issues or ask for help on a general forum like Stack Overflow.
Prework
Bug
Using {targets} 1.7.0, {tarchetypes} 0.9.0, {arrow} 16.1.0.
A bit of a niche issue!
I have a target that is made up by a tibble, and the tibble contains a list-column. It works fine if the elements of the list-column are factors:
Created on 2024-05-30 with reprex v2.1.0
If the factors are ordered, the Parquet write fails:
No issues if the tibble/data.frame contains regular columns, either ordered or unordered:
List-columns in data frames are ugly or non-functional, so I'm not trying those.
Thanks!