Jefffrey commented on code in PR #23444:
URL: https://github.com/apache/datafusion/pull/23444#discussion_r3562706171
##########
datafusion/functions/src/datetime/date_part.rs:
##########
@@ -406,6 +408,32 @@ fn seconds_as_i32(array: &dyn Array, unit: TimeUnit) ->
Result<ArrayRef> {
return not_impl_err!("Date part {unit:?} not supported");
}
+ // Fast path with seconds - no need to compute nanoseconds
+ if unit == Second {
+ return Ok(date_part(array, DatePart::Second)?);
+ }
+
+ // Fast path for Date32 and Date64 - no seconds
+ match array.data_type() {
Review Comment:
```rust
if array.data_type() == &Date32 || array.data_type() == &Date64 {
return Ok(Arc::new(Int32Array::new(
vec![0; array.len()].into(),
array.nulls().cloned(),
)));
}
```
applicable below too
--
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]