0lai0 commented on code in PR #5193:
URL: https://github.com/apache/datafusion-comet/pull/5193#discussion_r3699373500
##########
native/spark-expr/src/math_funcs/internal/make_decimal.rs:
##########
@@ -45,14 +47,41 @@ pub fn spark_make_decimal(
ColumnarValue::Array(a) => match a.data_type() {
DataType::Int64 => {
let arr = a.as_primitive::<Int64Type>();
- let mut result = Decimal128Builder::new();
- for v in arr.into_iter() {
- result.append_option(long_to_decimal(v, precision, scale,
fail_on_error)?)
- }
let result_type = DataType::Decimal128(precision, scale);
+ // The Int64 is already the unscaled Decimal128 value, so we
only reinterpret
+ // the bits (an Arrow Int64->Decimal cast would rescale the
value). Both arity
+ // helpers reuse the input null buffer and only invoke the
closure on valid rows.
+ let result: Decimal128Array = if fail_on_error {
Review Comment:
`make_decimal` update in
https://github.com/apache/datafusion-comet/pull/5193/changes/abde5801a1f8184d48817804f30d72f5eecbe6e2
`unary `+ scan update in
https://github.com/apache/datafusion-comet/pull/5193/changes/89873f85283b1e8154cad7207af0bc26e7d219f2
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]