comphead commented on code in PR #8159:
URL: https://github.com/apache/arrow-datafusion/pull/8159#discussion_r1409629268
##########
datafusion/physical-expr/src/expressions/cast.rs:
##########
@@ -176,7 +176,20 @@ pub fn cast_column(
kernels::cast::cast_with_options(array, cast_type, &cast_options)?,
)),
ColumnarValue::Scalar(scalar) => {
- let scalar_array = scalar.to_array()?;
+ let scalar_array = if cast_type
+ == &DataType::Timestamp(arrow_schema::TimeUnit::Nanosecond,
None)
+ {
+ if let ScalarValue::Float64(Some(float_ts)) = scalar {
+ ScalarValue::Int64(
+ Some((float_ts * 1_000_000_000_f64).trunc() as i64),
Review Comment:
I think here complexity can be reduced. too many conditions
--
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]