File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
datafusion/functions/src/datetime Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ use datafusion_macros::user_doc;
7373 - nanosecond
7474 - dow (day of the week where Sunday is 0)
7575 - doy (day of the year)
76- - epoch (seconds since Unix epoch)
76+ - epoch (seconds since Unix epoch for timestamps/dates, total seconds for intervals )
7777 - isodow (day of the week where Monday is 0)
7878"#
7979 ) ,
@@ -352,6 +352,10 @@ fn seconds(array: &dyn Array, unit: TimeUnit) -> Result<ArrayRef> {
352352
353353fn epoch ( array : & dyn Array ) -> Result < ArrayRef > {
354354 const SECONDS_IN_A_DAY : f64 = 86400_f64 ;
355+ // Note: Month-to-second conversion uses 30 days as an approximation.
356+ // This matches PostgreSQL's behavior for interval epoch extraction,
357+ // but does not represent exact calendar months (which vary 28-31 days).
358+ // See: https://doxygen.postgresql.org/datatype_2timestamp_8h.html
355359 const DAYS_PER_MONTH : f64 = 30_f64 ;
356360
357361 let f: Float64Array = match array. data_type ( ) {
You can’t perform that action at this time.
0 commit comments