pitrou commented on code in PR #12055:
URL: https://github.com/apache/arrow/pull/12055#discussion_r849619835


##########
cpp/src/arrow/chunked_array.cc:
##########
@@ -44,18 +45,20 @@ class MemoryPool;
 
 ChunkedArray::ChunkedArray(ArrayVector chunks, std::shared_ptr<DataType> type)
     : chunks_(std::move(chunks)), type_(std::move(type)) {
-  length_ = 0;
-  null_count_ = 0;
-
   if (type_ == nullptr) {
     ARROW_CHECK_GT(chunks_.size(), 0)
         << "cannot construct ChunkedArray from empty vector and omitted type";
     type_ = chunks_[0]->type();
   }
+
+  length_ = 0;
+  null_count_ = 0;

Review Comment:
   Generally it sounds better to keep initializations together, for readability 
(so that you only have one place to look at). So I would favor putting all 
initializations in the constructor, if non-trivial. If all initializations are 
trivial (e.g. to a constant), then it's fine to put them in the attribute 
declarations.
   



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