rok commented on a change in pull request #12136:
URL: https://github.com/apache/arrow/pull/12136#discussion_r791953839
##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.cc
##########
@@ -180,6 +207,47 @@ std::shared_ptr<DataType> CommonNumeric(const ValueDescr*
begin, size_t count) {
return int8();
}
+TimeUnit::type CommonTemporalResolution(const ValueDescr* begin, size_t count)
{
+ TimeUnit::type finest_unit = TimeUnit::SECOND;
+ const ValueDescr* end = begin + count;
+ for (auto it = begin; it != end; it++) {
+ auto id = it->type->id();
+ switch (id) {
+ case Type::DATE32: {
+ // Date32's unit is days, but the coarsest we have is seconds
+ continue;
+ }
+ case Type::DATE64: {
+ finest_unit = std::max(finest_unit, TimeUnit::MILLI);
+ continue;
+ }
+ case Type::TIMESTAMP: {
+ const auto& ty = checked_cast<const TimestampType&>(*it->type);
+ finest_unit = std::max(finest_unit, ty.unit());
+ continue;
+ }
+ case Type::DURATION: {
+ const auto& ty = checked_cast<const DurationType&>(*it->type);
+ finest_unit = std::max(finest_unit, ty.unit());
+ continue;
+ }
+ case Type::TIME32: {
+ const auto& ty = checked_cast<const Time32Type&>(*it->type);
+ finest_unit = std::max(finest_unit, ty.unit());
+ continue;
+ }
+ case Type::TIME64: {
+ const auto& ty = checked_cast<const Time32Type&>(*it->type);
Review comment:
Aaah that's tripping the tests! Thanks for spotting it!
--
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]