milesgranger commented on code in PR #14696:
URL: https://github.com/apache/arrow/pull/14696#discussion_r1038714941


##########
cpp/src/arrow/compute/kernels/scalar_nested.cc:
##########
@@ -96,6 +97,15 @@ std::string ToString(const std::optional<T>& o) {
   return o.has_value() ? ToChars(*o) : "(nullopt)";
 }
 
+int64_t MaxSliceLength(const int64_t start, const int64_t stop, const int64_t 
step) {
+  const auto startf = static_cast<float>(start);
+  const auto stopf = static_cast<float>(stop);
+  const auto stepf = static_cast<float>(step);
+
+  auto length = std::ceil((stopf - startf) / stepf);
+  return static_cast<int64_t>(length);
+}

Review Comment:
   ah, had to catch the the divisor (step) being >= 1 before the call in the 
resolver. Updated in 
https://github.com/apache/arrow/pull/14696/commits/ad6d055496a5204bba05454c076f25df24dfb01e



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