penberg / limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
MIT License
993 stars 60 forks source link

implement min max scalar function #197

Closed brayanjuls closed 3 months ago

brayanjuls commented 3 months ago

This is related to issue #144. Currently the name of the scalar functions min and max are conflicting with the aggregated functions min and max. I am using min_arr and max_arr instead and wanted to get your input on what we can do to keep both with the same name. What comes to my mind is adding conditional logic inside AggFunc::Min/Max.

penberg commented 3 months ago

@brayanjuls The need to change the function resolution code to allow function overloading. That is, the number of arguments should be a factor in which function we pick.

brayanjuls commented 3 months ago

@brayanjuls The need to change the function resolution code to allow function overloading. That is, the number of arguments should be a factor in which function we pick.

I thought rust did not support function overloading by the number of parameters. I am going to investigate it and implement it. Thanks.

penberg commented 3 months ago

@brayanjuls Rust doesn't support that. But the point was that FromStr trait for Func should map max to aggregate or scalar depending on how many arguments got passed to it. That may be not possible with the FromStr trait so we might want to introduce a resolve_function(name, arg_count) helper somewhere.