mapleFU commented on code in PR #35149:
URL: https://github.com/apache/arrow/pull/35149#discussion_r1183927908


##########
cpp/src/arrow/array/array_base.h:
##########
@@ -69,16 +69,37 @@ class ARROW_EXPORT Array {
     // a potential inner-branch removal.
     if (type_id() == Type::SPARSE_UNION) {
       return !internal::IsNullSparseUnion(*data_, i);
-    }

Review Comment:
   Why change it to if else? I think it's not necessary here
   clang-tidy has a check about this style ( 
https://clang.llvm.org/extra/clang-tidy/checks/readability/else-after-return.html
 ), although we don't enable this check, I think just return without if else is 
ok



##########
cpp/src/arrow/array/data.h:
##########
@@ -434,16 +455,36 @@ struct ARROW_EXPORT ArraySpan {
   inline bool IsValid(int64_t i) const {
     if (this->buffers[0].data != NULLPTR) {
       return bit_util::GetBit(this->buffers[0].data, i + this->offset);
+    }
+    const auto type = this->type->id();
+    if (type == Type::SPARSE_UNION) {
+      return !IsNullSparseUnion(i);
+    } else if (type == Type::DENSE_UNION) {
+      return !IsNullDenseUnion(i);
+    } else if (type == Type::RUN_END_ENCODED) {
+      return !IsNullRunEndEncoded(i);
+    }
+    return this->null_count != this->length;
+  }
+
+  template <typename ArrowType>
+  inline bool IsNullFast(int64_t i) const {
+    return !IsValidFast<ArrowType>(i);
+  }
+
+  template <typename ArrowType>
+  inline bool IsValidFast(int64_t i) const {
+    if constexpr (ArrowType::type_id == Type::NA) {

Review Comment:
   Okay, though it's still a bit wired for me. I think we can hear about others 
idea.



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