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

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

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


##########
cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc:
##########
@@ -452,6 +459,16 @@ void AddCrossUnitCast(CastFunction* func) {
   DCHECK_OK(func->AddKernel(Type::type_id, std::move(kernel)));
 }
 
+template <typename Type>
+void AddCrossUnitCastNoPreallocate(CastFunction* func) {
+  ScalarKernel kernel;
+  kernel.exec = CastFunctor<Type, Type>::Exec;
+  kernel.null_handling = NullHandling::INTERSECTION;
+  kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;

Review Comment:
   ```suggestion
     // We cannot preallocate in this case because some of these casts may be zero
     // copy if only the timezone (and not the units) change.  There is no way to distinguish
     // between these two cases based on input matching so we disable preallocation for
     // all of them.
     kernel.mem_allocation = MemAllocation::NO_PREALLOCATE;
   ```



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