alamb opened a new issue, #5641: URL: https://github.com/apache/arrow-datafusion/issues/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.zip](https://github.com/apache/arrow-datafusion/files/11011030/cpu.zip) ```sql ❯ select date_bin('1 hour', time, '1970-01-01') from 'cpu.parquet'; ``` This query doesn't (omitting the `'1970-01-01'` origin) ```sql ❯ select date_bin('1 hour', time) from 'cpu.parquet'; Error during planning: Coercion from [Utf8, Timestamp(Nanosecond, None)] to the signature Exact([Interval(DayTime), Timestamp(Nanosecond, None), Timestamp(Nanosecond, None)]) failed. ``` **Describe the solution you'd like** I would like ```sql ❯ select date_bin('1 hour', time) from 'cpu.parquet'; ``` to run and give the same answer as ```sql ❯ select date_bin('1 hour', time, '1970-01-01') from 'cpu.parquet'; ``` **Describe alternatives you've considered** <!-- A clear and concise description of any alternative solutions or features 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 -- 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]
