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 x from foo order by 'foo';
ArrowError(ExternalError(Internal("Sort operation is not applicable to scalar value foo")))
select x from foo order by null;
ArrowError(ExternalError(Internal("Sort operation is not applicable to scalar value NULL")))
> select x from foo order by x, null;
ArrowError(ExternalError(Internal("Sort operation is not applicable to scalar value NULL")))```
I found this while working on #1184, but I am not sure it is related to null literals. I think we simply need to teach the sort operation about literals.