alamb opened a new issue, #5595: URL: https://github.com/apache/arrow-datafusion/issues/5595
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** @Jefffrey notes in https://github.com/apache/arrow-datafusion/pull/5560#pullrequestreview-1336092803 that we are inconsistent with polars, which seems to return null for empty inputs: >>> df = pl.DataFrame({"foo": []}) >>> df.median() shape: (1, 1) ┌──────┐ │ foo │ │ --- │ │ f32 │ ╞══════╡ │ null │ └──────┘ >>> **Describe the solution you'd like** Be consistent with polars (return null) . While postgres does not support `median` so we can't use its behavior as a guide, returning `null` on empty input would be consistent with the other sql aggregate functions such as `sum` For example: ```sql postgres=# create table t as values (1); SELECT 1 postgres=# select median(column1) from t where column1 < 0; ERROR: function median(integer) does not exist LINE 1: select median(column1) from t where column1 < 0; ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. postgres=# select sum(column1) from t where column1 < 0; sum ----- (1 row) ``` **Describe alternatives you've considered** Leave as error **Additional context** -- 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]
