Error during planning: No function matches the given name and argument types 'date_bin(Utf8, Timestamp(Nanosecond, Some("+00:00")), Utf8)'. You might need to add explicit type casts.
Candidate functions:
date_bin(Interval(MonthDayNano), Timestamp(Nanosecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Nanosecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Nanosecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(DayTime), Timestamp(Nanosecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Nanosecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Nanosecond, None))
date_bin(Interval(DayTime), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Microsecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Microsecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Microsecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(DayTime), Timestamp(Microsecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Microsecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Microsecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Microsecond, None))
date_bin(Interval(DayTime), Timestamp(Microsecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Millisecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Millisecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Millisecond, None), Timestamp(Nanosecond, None))
date_bin(Interval(DayTime), Timestamp(Millisecond, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Millisecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Millisecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Millisecond, None))
date_bin(Interval(DayTime), Timestamp(Millisecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Second, None), Timestamp(Nanosecond, None))
date_bin(Interval(MonthDayNano), Timestamp(Second, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Second, None), Timestamp(Nanosecond, None))
date_bin(Interval(DayTime), Timestamp(Second, Some("+TZ")), Timestamp(Nanosecond, Some("+TZ")))
date_bin(Interval(MonthDayNano), Timestamp(Second, None))
date_bin(Interval(MonthDayNano), Timestamp(Second, Some("+TZ")))
date_bin(Interval(DayTime), Timestamp(Second, None))
date_bin(Interval(DayTime), Timestamp(Second, Some("+TZ")))
-- Create a table with some timestamps in it.
CREATE TABLE test (
time TIMESTAMP WITH TIME ZONE
) AS VALUES
('2000-01-01T00:00:00Z'),
('2000-01-01T00:00:01Z');
-- Check that the column preserved the time zone.
SELECT arrow_typeof(time) FROM test;
-- Check that date_bin runs without an origin.
SELECT date_bin('1 minute', time) FROM test;
-- Check that date_bin runs with an origin.
SELECT date_bin('1 minute', time, '1970-01-01T00:00:00Z') FROM test;
Describe the bug
The optional third parameter to
date_bin, which is theorigintime, can normally be specified with a time constant in a string. If the inputexpressionhas a type that includes a time zone then datafusion returns the following error:To Reproduce
To reproduce run the following script in
datafusion-cli:Expected behavior
The
SELECT date_bin('1 minute', time) FROM test;andSELECT date_bin('1 minute', time, '1970-01-01T00:00:00Z') FROM test;queries should produce identical results.Additional context
The time zone support for
date_bindoesn't seem to be in a released version yet. I was testing this with adatafusion-clibuilt from commit4b2b7dcfc63abfc03b0279abe122c5bdfcca5275.