Copilot commented on code in PR #49710:
URL: https://github.com/apache/arrow/pull/49710#discussion_r3316930652
##########
r/tests/testthat/test-Table.R:
##########
@@ -371,6 +371,22 @@ test_that("Can create table with specific dictionary
types", {
}
})
+test_that("Table converts dictionary arrays with wider index types back to R",
{
+ fact <- example_data[, "fct"]
+
+ tab_uint32 <- Table$create(fact, schema = schema(fct = dictionary(uint32(),
utf8())))
+ expect_equal(tab_uint32$schema, schema(fct = dictionary(uint32(), utf8())))
+ expect_equal_data_frame(tab_uint32, fact)
+
+ tab_int64 <- Table$create(fact, schema = schema(fct = dictionary(int64(),
utf8())))
+ expect_equal(tab_int64$schema, schema(fct = dictionary(int64(), utf8())))
+ expect_equal_data_frame(tab_int64, fact)
+
+ tab_uint64 <- Table$create(fact, schema = schema(fct = dictionary(uint64(),
utf8())))
+ expect_equal(tab_uint64$schema, schema(fct = dictionary(uint64(), utf8())))
+ expect_equal_data_frame(tab_uint64, fact)
Review Comment:
The original bug report (#39603) involves `dictionary<values=large_string,
indices=uint32>`, but the new test only exercises `utf8()` dictionary values,
not `large_utf8()`. Since the ALTREP factor path explicitly bails out for
non-`STRING` dictionary value types (see `r/src/altrep.cpp:452-457`), only the
`large_utf8()` case actually exercises the changed non-ALTREP
`Converter_Dictionary` code path for string-like dictionaries. Consider adding
a test case using `dictionary(uint32(), large_utf8())` to directly cover the
originally reported scenario.
--
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]