corpoverlords commented on code in PR #47531:
URL: https://github.com/apache/arrow/pull/47531#discussion_r2349562435


##########
cpp/src/arrow/stl_iterator_test.cc:
##########
@@ -545,5 +607,62 @@ TEST(ChunkedArrayIterator, ForEachIterator) {
   ASSERT_EQ(values, expected);
 }
 
+TEST(ChunkedArrayIterator, CustomValueAccessorDictionary) {
+  // Create multiple dictionary arrays with the same dictionary
+  auto dict = ArrayFromJSON(utf8(), R"(["red", "green", "blue", "yellow"])");
+
+  auto indices1 = ArrayFromJSON(int32(), "[0, 1, 2]");
+  auto indices2 = ArrayFromJSON(int32(), "[3, 2, null]");
+  auto indices3 = ArrayFromJSON(int32(), "[1, 0, 3, 2]");
+
+  auto dict_type = dictionary(int32(), utf8());
+  auto dict_array1 = std::make_shared<DictionaryArray>(dict_type, indices1, 
dict);
+  auto dict_array2 = std::make_shared<DictionaryArray>(dict_type, indices2, 
dict);
+  auto dict_array3 = std::make_shared<DictionaryArray>(dict_type, indices3, 
dict);
+
+  // Create chunked array from dictionary arrays
+  auto chunked_array = std::make_shared<ChunkedArray>(
+      std::vector<std::shared_ptr<Array>>{dict_array1, dict_array2, 
dict_array3},
+      dict_type);
+
+  // Use custom accessor to iterate over decoded values across chunks
+  auto it =
+      Begin<DictionaryType, DictionaryArray, 
TestDictionaryValueAccessor>(*chunked_array);

Review Comment:
   I looked at how to do this for a while, it seems to me that this will 
require adding the include to `stl_iterator.h` in `chunked_array.h`. I think 
for now we can first fix the existing accessor, and I can add the `range` 
function in a later PR.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to