neilconway commented on code in PR #20499:
URL: https://github.com/apache/datafusion/pull/20499#discussion_r2848922256
##########
datafusion/sqllogictest/test_files/datetime/timestamps.slt:
##########
@@ -771,6 +771,12 @@ select to_timestamp_seconds(cast (1 as int));
## test date_bin function
##########
+# NULL stride should return NULL, not a planning error
+query P
+SELECT date_bin(NULL, TIMESTAMP '2023-01-01 12:30:00', TIMESTAMP '2023-01-01
12:00:00')
Review Comment:
nit: can we test the two-argument version of the function as well?
##########
datafusion/functions/src/datetime/date_bin.rs:
##########
@@ -392,6 +392,13 @@ fn date_bin_impl(
origin: &ColumnarValue,
) -> Result<ColumnarValue> {
let stride = match stride {
+ ColumnarValue::Scalar(ScalarValue::IntervalDayTime(None))
+ | ColumnarValue::Scalar(ScalarValue::IntervalMonthDayNano(None)) => {
+ // NULL stride -> NULL result (standard SQL NULL propagation)
Review Comment:
```suggestion
ColumnarValue::Scalar(s) if s.is_null() => {
// NULL stride -> NULL result
```
--
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]