nix010 commented on code in PR #11454:
URL: https://github.com/apache/datafusion/pull/11454#discussion_r1678672697


##########
datafusion/expr/src/columnar_value.rs:
##########
@@ -195,19 +195,39 @@ impl ColumnarValue {
                 kernels::cast::cast_with_options(array, cast_type, 
&cast_options)?,
             )),
             ColumnarValue::Scalar(scalar) => {
-                let scalar_array =
-                    if cast_type == &DataType::Timestamp(TimeUnit::Nanosecond, 
None) {
-                        if let ScalarValue::Float64(Some(float_ts)) = scalar {
-                            ScalarValue::Int64(Some(
-                                (float_ts * 1_000_000_000_f64).trunc() as i64,
-                            ))
-                            .to_array()?
-                        } else {
-                            scalar.to_array()?
-                        }
+                let scalar_array = if cast_type
+                    == &DataType::Timestamp(TimeUnit::Nanosecond, None)
+                {
+                    if let ScalarValue::Float64(Some(float_ts)) = scalar {
+                        ScalarValue::Int64(Some(
+                            (float_ts * 1_000_000_000_f64).trunc() as i64
+                        ))
+                        .to_array()?
                     } else {
                         scalar.to_array()?
-                    };
+                    }
+                } else {
+                    // Arrow by default will parse str as Month for unit 
MonthDayNano.
+                    // So we need to be explict that we want it to parse as 
second.
+                    match (scalar, cast_type) {

Review Comment:
   Sorry but as my understand is that `kernels::cast` is within `arrow-cast` 
which it a different repo. So you mean this change is should happen in 
`arrow-cast` repo ?



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

Reply via email to