You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support date_bin with 2 arguments (rather than requiring three) #5641
❯ select date_bin('1 hour', time, '1970-01-01') from'cpu.parquet';
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
changed the title [-]Support date_bin with 2 arguments (rather than requiring three)[/-][+]Support `date_bin` with 2 arguments (rather than requiring three)[/+]on Mar 19, 2023
hi @alamb thank you for raising this, it looks great.
one thing i'm still struggleing is whether select date_bin('30 minutes', '1970-01-01T00:31:01+08:00');
should output 1969-12-31T16:30:00
or 1970-01-01T00:30:00
note that datafusion currently outputs timestamp
❯ selectdate_bin('30 minutes', timestamp '1970-01-01T00:31:01+08:00', '1970-01-01');+----------------------------------------------------------------------------------+| datebin(Utf8("30 minutes"),Utf8("1970-01-01T00:31:01+08:00"),Utf8("1970-01-01")) |+----------------------------------------------------------------------------------+| 1969-12-31T16:30:00 |+----------------------------------------------------------------------------------+1 row in set. Query took 0.003 seconds.
while posgresql outputs timestamptz if either source or origin is timestamptz
while posgresql outputs timestamptz if either source or origin is timestamptz
I think this behavior would make sense to me (though that probably involves making date_bin return a different type based on the types of its arguments
Activity
[-]Support date_bin with 2 arguments (rather than requiring three)[/-][+]Support `date_bin` with 2 arguments (rather than requiring three)[/+]alamb commentedon Mar 19, 2023
cc @waitingkuo
waitingkuo commentedon Mar 20, 2023
hi @alamb thank you for raising this, it looks great.
one thing i'm still struggleing is whether
select date_bin('30 minutes', '1970-01-01T00:31:01+08:00');should output
1969-12-31T16:30:00or
1970-01-01T00:30:00note that datafusion currently outputs
timestampwhile posgresql outputs
timestamptzif eithersourceororiginistimestamptzalamb commentedon Mar 20, 2023
I think this behavior would make sense to me (though that probably involves making date_bin return a different type based on the types of its arguments