jonahgao commented on PR #14046:
URL: https://github.com/apache/datafusion/pull/14046#issuecomment-2579269061
> Why haven’t we been displaying `null` values as `NULL` so far? What was
the original reasoning or intention behind this decision?
I guess it's to follow PostgreSQL CLI. PostgreSQL CLI does not display null
values as well, but it always displays null elements of arrays as NULL.
```sh
$ psql
psql (16.6 (Ubuntu 16.6-0ubuntu0.24.04.1))
Type "help" for help.
psql=> select null, array[null, 1, null];
?column? | array
----------+---------------
| {NULL,1,NULL}
(1 row)
psql=> \pset null mynull
Null display is "mynull".
psql=> select null, array[null, 1, null];
?column? | array
----------+---------------
mynull | {NULL,1,NULL}
(1 row)
```
I think we can follow PostgreSQL more thoroughly, or always display null,
regardless of whether it is a list element.
The latter can be achieved by setting
[FormatOptions](https://github.com/apache/arrow-rs/blob/d0260fcffa07a4cb8650cc290ab29027a3a8e65c/arrow-cast/src/display.rs#L62).
The fix should not involve the DataFusion core; it should be related to
DataFusion CLI and sqllogictests.
Some displays of DataFusion CLI are not user-friendly, for example
```sh
DataFusion CLI v44.0.0
> select array[null, null, null,1,null];
+------------------------------------------+
| make_array(NULL,NULL,NULL,Int64(1),NULL) |
+------------------------------------------+
| [, , , 1, ] |
+------------------------------------------+
1 row(s) fetched.
Elapsed 0.006 seconds.
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]