Jefffrey commented on issue #4314: URL: https://github.com/apache/datafusion/issues/4314#issuecomment-3290292036
From current main, these are results of `var_samp()` and `var_pop()` on single item: ```sql DataFusion CLI v50.0.0 > select var_samp(1); +---------------+ | var(Int64(1)) | +---------------+ | NULL | +---------------+ 1 row(s) fetched. Elapsed 0.023 seconds. > select var_pop(1); +-------------------+ | var_pop(Int64(1)) | +-------------------+ | 0.0 | +-------------------+ 1 row(s) fetched. Elapsed 0.007 seconds. ``` Can see this in the slt tests too: https://github.com/apache/datafusion/blob/e2c2d3840e010cdf4b3104d4ceb21174d9afeeb3/datafusion/sqllogictest/test_files/aggregate.slt#L3108-L3115 https://github.com/apache/datafusion/blob/e2c2d3840e010cdf4b3104d4ceb21174d9afeeb3/datafusion/sqllogictest/test_files/aggregate.slt#L3168-L3175 This matches with Spark, Postgres and DuckDB. **Spark** ```sql spark-sql (default)> select version(); 4.0.0 fa33ea000a0bda9e5a3fa1af98e8e85b8cc5e4d4 Time taken: 1.066 seconds, Fetched 1 row(s) spark-sql (default)> select var_samp(1); NULL Time taken: 0.219 seconds, Fetched 1 row(s) spark-sql (default)> select var_pop(1); 0.0 Time taken: 0.076 seconds, Fetched 1 row(s) ``` **Postgres** ```sql psql (17.6 (Debian 17.6-1.pgdg13+1)) Type "help" for help. postgres=# select var_samp(1); var_samp ---------- (1 row) postgres=# select var_pop(1); var_pop --------- 0 (1 row) ``` **DuckDB** ```sql DuckDB v1.3.2 (Ossivalis) 0b83e5d2f6 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. D select var_samp(1); ┌─────────────┐ │ var_samp(1) │ │ double │ ├─────────────┤ │ NULL │ └─────────────┘ D select var_pop(1); ┌────────────┐ │ var_pop(1) │ │ double │ ├────────────┤ │ 0.0 │ └────────────┘ ``` Closing this issue as it seems behaviour is as expected. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org