thisisnic commented on code in PR #49712:
URL: https://github.com/apache/arrow/pull/49712#discussion_r3190867507
##########
r/src/array_to_vector.cpp:
##########
@@ -612,6 +619,16 @@ class Converter_Dictionary : public Converter {
dictionary_ = CreateEmptyArray(dict_type.value_type());
}
}
+
+ // R factors store their codes in 32-bit integers, so dictionary arrays
with
+ // more levels than that cannot be represented safely.
+ if (dictionary_->length() > std::numeric_limits<int>::max()) {
+ const auto& dict_type = checked_cast<const
DictionaryType&>(*chunked_array->type());
+ cpp11::stop(
+ "Cannot convert Dictionary Array of type `%s` to R: dictionary has "
+ "more levels than an R factor can represent",
+ dict_type.ToString().c_str());
Review Comment:
We should add a test for this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]