edponce commented on code in PR #12660:
URL: https://github.com/apache/arrow/pull/12660#discussion_r852070254


##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -1397,22 +1396,8 @@ struct RoundToMultiple {
 
   CType multiple;
 
-  explicit RoundToMultiple(const State& state, const DataType& out_ty) {
-    const auto& options = state.options;
-    DCHECK(options.multiple);
-    DCHECK(options.multiple->is_valid);
-    DCHECK(is_floating(options.multiple->type->id()));
-    switch (options.multiple->type->id()) {
-      case Type::FLOAT:
-        multiple = 
static_cast<CType>(UnboxScalar<FloatType>::Unbox(*options.multiple));
-        break;
-      case Type::DOUBLE:
-        multiple = 
static_cast<CType>(UnboxScalar<DoubleType>::Unbox(*options.multiple));
-        break;
-      default:
-        DCHECK(false);
-    }
-  }
+  explicit RoundToMultiple(const State& state, const DataType& out_ty)
+      : multiple(UnboxScalar<ArrowType>::Unbox(*state.options.multiple)) {}

Review Comment:
   The DCHECKS for `options.multiple` are equivalent to the checks performed in 
[`RoundOptionsWrapper`](https://github.com/apache/arrow/pull/12660/files#diff-3eafd7246f6a8c699f10d46e3276852fe44b6853b5517ef10396e561730c09f4R1239).
 It is ok to add them to at least validate the cast to floating-point.



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