You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/04 16:17:34 UTC

[GitHub] [arrow] AlvinJ15 commented on a diff in pull request #13009: ARROW-602: [C++] Provide iterator access to primitive elements inside an Array

AlvinJ15 commented on code in PR #13009:
URL: https://github.com/apache/arrow/pull/13009#discussion_r865026443


##########
cpp/src/arrow/stl_iterator.h:
##########
@@ -59,11 +62,12 @@ class ArrayIterator {
 
   // Value access
   value_type operator*() const {
-    return array_->IsNull(index_) ? value_type{} : array_->GetView(index_);
+    return !array_ || array_->IsNull(index_) ? value_type{} : array_->GetView(index_);

Review Comment:
   When a `ChunkedArray` is empty, I initialize an `ArrayIterator` with the empty constructor which initialize the `array_` with a `NULLPTR`, and this extra condition is more feasible/short than adding more conditions on ChunkedArrayIterator for validate multiple cases.



-- 
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-unsubscribe@arrow.apache.org

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