You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[R] Error: Cannot convert Dictionary Array of type dictionary<values=large_string, indices=uint32, ordered=0> to R #39603
Describe the bug, including details regarding any error messages, version, and platform.
ChunkedArray objects of type "DictionnaryType" have the method as_vector (as do ChunkedArray objects of other types) but calling that method ends with an error.
I am using the R package polars to create a problematic ChunkedArray. This is how I discovered the issue and I did not find how to create a similar ChunkedArray using the R package arrow alone:
changed the title [-]Error: Cannot convert Dictionary Array of type `dictionary<values=large_string, indices=uint32, ordered=0>` to R[/-][+][R] Error: Cannot convert Dictionary Array of type `dictionary<values=large_string, indices=uint32, ordered=0>` to R[/+]on Jan 15, 2024
// TODO: also add int64, uint32, uint64 downcasts, if possible
break;
default:
cpp11::stop("Cannot convert Dictionary Array of type `%s` to R",
dict_type.ToString().c_str());
As a workaround until this feature is added, you should be able to cast() to a similar type but with int32 indices so long as your indices can be contained within an int32:
This bug or one with the same error message also seems to prevent R Arrow from reading Parquet files with Categorical or Enum columns created in Python Polars.
Reprex tested with Python Polars 1.31.0 and R Arrow 20.0.0.2:
# In Python:importpolarsaspldata=pl.DataFrame({"x": ["a", "b"]}, schema={"x": pl.Categorical})
data.write_parquet("test.parquet")
# In R:
library("arrow")
read_parquet("test.parquet")
Error message:
Error: Cannot convert Dictionary Array of type `dictionary<values=string, indices=uint32, ordered=0>` to R
Reacted by Ben Toh, mihoednie, Sandy and Alistair Pattison
Activity
lgautier commentedon Jan 14, 2024
I found this in the documentation, where the conversion of a
ChunkedArrayof type dictionnary to an R vector is working: https://arrow.apache.org/docs/r/articles/data_types.htmlThe issue seems to be when
valuesis of typelarge_string.[-]Error: Cannot convert Dictionary Array of type `dictionary<values=large_string, indices=uint32, ordered=0>` to R[/-][+][R] Error: Cannot convert Dictionary Array of type `dictionary<values=large_string, indices=uint32, ordered=0>` to R[/+]amoeba commentedon Jan 18, 2024
Hi @lgautier, thanks for the report. It looks like the issue is that the conversion routine this uses doesn't support
uint32indices:arrow/r/src/array_to_vector.cpp
Lines 593 to 603 in c170af4
As a workaround until this feature is added, you should be able to
cast()to a similar type but with int32 indices so long as your indices can be contained within an int32:The pure arrow reproducer for this is,
nick-ulle commentedon Jul 22, 2025
This bug or one with the same error message also seems to prevent R Arrow from reading Parquet files with Categorical or Enum columns created in Python Polars.
Reprex tested with Python Polars 1.31.0 and R Arrow 20.0.0.2:
Error message:
GH-39603: [R] Error: Cannot convert Dictionary Array of type dictiona…
thisisnic commentedon Jun 10, 2026
Issue resolved by pull request 49710
#49710