Support date_bin
with 2 arguments (rather than requiring three)
#5641
Labels
date_bin
with 2 arguments (rather than requiring three)
#5641
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I am trying to bin my data by some particular interval using the
date_bin
function. Datafusion follows the postgres model https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-BIN that requires a third argument for "origin" (where to start the bins)However for most queries, the unix epoch is likely the bin that is desired (or something that starts on the start of a day)
This query in
datafusion-cli
with this file works great on cpu.zipThis query doesn't (omitting the
'1970-01-01'
origin)Describe the solution you'd like
I would like
to run and give the same answer as
Describe alternatives you've considered
Additional context
I think this is a good way to add something to datafusion as most of the plumbing is there already and we simply need to add another variant of
date_bin
The existing tests can be followed: https://github.com/apache/arrow-datafusion/blob/3ccf1aebb6959fbc6bbbf74d2821522ddfd7d484/datafusion/core/tests/sqllogictests/test_files/timestamps.slt#L100
The text was updated successfully, but these errors were encountered: