You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "rok (via GitHub)" <gi...@apache.org> on 2023/02/21 23:16:37 UTC

[GitHub] [arrow] rok commented on a diff in pull request #34270: GH-34210: [C++] Unexpected performance when casting from tz-naive to tz-aware timestamps

rok commented on code in PR #34270:
URL: https://github.com/apache/arrow/pull/34270#discussion_r1113666743


##########
cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc:
##########
@@ -153,8 +155,12 @@ struct CastFunctor<
     const auto& in_type = checked_cast<const I&>(*batch[0].type());
     const auto& out_type = checked_cast<const O&>(*output->type);
 
-    // The units may be equal if the time zones are different. We might go to
-    // lengths to make this zero copy in the future but we leave it for now
+    if (I::type_id == Type::TIMESTAMP && in_type.unit() == out_type.unit()) {
+      std::shared_ptr<const ArrayData> array_data = input.ToArrayData();
+      output->SetMembers(*array_data);
+      arrow::compute::detail::PropagateNullsSpans(batch, output);

Review Comment:
   I assumed (hoped) this would zero-copy the null bitmap. I suppose things are a little bit more subtle and I'll go read up a little bit.



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