vaibhawvipul commented on code in PR #384:
URL: https://github.com/apache/datafusion-comet/pull/384#discussion_r1592854344


##########
core/src/execution/datafusion/expressions/cast.rs:
##########
@@ -395,6 +399,58 @@ impl Cast {
         Ok(cast_array)
     }
 
+    fn cast_float64_to_decimal128(
+        array: &dyn Array,
+        precision: u8,
+        scale: i8,
+        eval_mode: EvalMode,
+    ) -> CometResult<ArrayRef> {
+        let input = array.as_any().downcast_ref::<Float64Array>().unwrap();
+        let mut cast_array = 
PrimitiveArray::<Decimal128Type>::builder(input.len());
+
+        let mul = (precision as f64).powi(scale as i32);

Review Comment:
   nice catch.. it was a bug.
   
   ```let mul = 10_f64.powi(scale as i32);``` taken from decimal.rs - 
arrow_cast.



-- 
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-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to