EnricoMi commented on code in PR #48458: URL: https://github.com/apache/arrow/pull/48458#discussion_r2664131422
########## python/pyarrow/src/arrow/python/numpy_to_arrow.cc: ########## @@ -364,15 +364,33 @@ Status CastBuffer(const std::shared_ptr<DataType>& in_type, return Status::OK(); } +// Cast buffer from FromType to ToType with optional overflow checking. +// This function only supports narrowing casts (FromType wider than ToType). +// Do not use this function for widening casts (ToType wider than FromType). template <typename FromType, typename ToType> -Status StaticCastBuffer(const Buffer& input, const int64_t length, MemoryPool* pool, +Status StaticCastBuffer(const Buffer& input, int64_t length, MemoryPool* pool, Review Comment: Maybe this method name makes this "limitation" or "assumption" more obvious in calling code: ```suggestion Status StaticDowncastBuffer(const Buffer& input, int64_t length, MemoryPool* pool, ``` -- 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]
