You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "stuartcarnie (via GitHub)" <gi...@apache.org> on 2023/03/23 20:05:25 UTC

[GitHub] [arrow-datafusion] stuartcarnie commented on a diff in pull request #5698: feat: `date_bin` supports MonthDayNano, microsecond and nanosecond units

stuartcarnie commented on code in PR #5698:
URL: https://github.com/apache/arrow-datafusion/pull/5698#discussion_r1146768915


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -354,6 +354,24 @@ fn date_bin_impl(
                 }
             }
         }
+        ColumnarValue::Scalar(ScalarValue::IntervalMonthDayNano(Some(v))) => {
+            let (months, days, nanos) = IntervalMonthDayNanoType::to_parts(*v);
+            if months != 0 {
+                return Err(DataFusionError::NotImplemented(
+                    "DATE_BIN stride does not support month intervals".to_string(),

Review Comment:
   Correct.
   
   We'll need to round to the first of the month, and those nanosecond intervals are not regular. We'll probably be best served using the `chrono` package to handle month and year rounding.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org