Reproducer:
echo "1" > /tmp/foo.csv
cargo run -p datafusion-cli
CREATE EXTERNAL TABLE foo(x int)
STORED AS CSV
LOCATION '/tmp/foo.csv';
> select percent_rank() OVER (partition by x) from foo;
+----------------+
| PERCENT_RANK() |
+----------------+
| 0 |
+----------------+
1 row in set. Query took 0.013 seconds.
> select percent_rank() OVER (partition by null) from foo;
ArrowError(ExternalError(ArrowError(ExternalError(Internal("Sort operation is not applicable to scalar value NULL")))))
> select percent_rank() OVER (partition by x order by null) from foo;
ArrowError(ExternalError(ArrowError(ExternalError(Internal("Sort operation is not applicable to scalar value NULL")))))
The correct output is null
See #1184 for more details