edponce commented on a change in pull request #12055:
URL: https://github.com/apache/arrow/pull/12055#discussion_r826222432



##########
File path: cpp/src/arrow/chunked_array.cc
##########
@@ -147,13 +148,15 @@ bool ChunkedArray::ApproxEquals(const ChunkedArray& other,
 }
 
 Result<std::shared_ptr<Scalar>> ChunkedArray::GetScalar(int64_t index) const {
-  for (const auto& chunk : chunks_) {
-    if (index < chunk->length()) {
-      return chunk->GetScalar(index);
-    }
-    index -= chunk->length();
+  if (!chunk_resolver_) {
+    chunk_resolver_ = internal::make_unique<internal::ChunkResolver>(chunks_);

Review comment:
       Oh, I see. [Immutable objects in Arrow need to be 
thread-safe](https://arrow.apache.org/docs/cpp/conventions.html?highlight=thread#immutability)
 :face_palm:




-- 
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]


Reply via email to