Skip to content

Commit

Permalink
Add comment to seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Mar 19, 2024
1 parent 456e2fe commit f550b64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datafusion/functions/src/datetime/date_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ fn date_part_f64(array: &dyn Array, part: DatePart) -> Result<ArrayRef> {
Ok(cast(date_part(array, part)?.as_ref(), &Float64)?)
}

/// invoke [`date_part`] on an `array` (e.g. Timestamp) and convert the
/// result to a total number of seconds, milliseconds, microseconds or
/// nanoseconds
///
/// # Panics
/// If `array` is not a temporal type such as Timestamp or Date32
fn seconds(array: &dyn Array, unit: TimeUnit) -> Result<ArrayRef> {
let sf = match unit {
Second => 1_f64,
Expand Down

0 comments on commit f550b64

Please sign in to comment.