comphead commented on code in PR #5643:
URL: https://github.com/apache/arrow-datafusion/pull/5643#discussion_r1142362953
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -319,13 +319,20 @@ fn date_bin_single(stride: i64, source: i64, origin: i64)
-> i64 {
/// DATE_BIN sql function
pub fn date_bin(args: &[ColumnarValue]) -> Result<ColumnarValue> {
- if args.len() != 3 {
+ if args.len() != 2 && args.len() != 3 {
Review Comment:
Thanks, unfortunately We poorly support overloaded functions, and have to
use confusing conditions.
However maybe it can be improved like
```
pub fn date_bin(args: &[ColumnarValue]) -> Result<ColumnarValue> {
check params count
if 3 the date_bin_3args
if 2 the date_bin_2args
else panic
}
pub fn date_bin_3args(args: &[ColumnarValue]) -> Result<ColumnarValue> {
main logic
}
pub fn date_bin_2args(args: &[ColumnarValue]) -> Result<ColumnarValue> {
order params
date_bin_3args(params);
}
```
--
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]