neilconway opened a new issue, #25210:
URL: https://github.com/apache/datafusion/issues/25210
### Describe the bug
`map[key]` decides which entries belong to a row by considering only the
map's offsets, not the validity buffer. However, the Arrow spec allows an
element of a map or list to be marked invalid/NULL in the validity buffer, but
still to have a non-empty offset range (such an element should be considered
NULL).
One way to get this in practice is via `nullif`, which is implemented by
modifying the input's validity buffer and not modifying offsets.
### To Reproduce
```sql
CREATE TABLE t AS
SELECT MAP {'a': 1, 'b': 2} AS m, MAP {'a': 1, 'b': 2} AS n
UNION ALL
SELECT MAP {'a': 3, 'b': 4}, MAP {'x': 9};
SELECT NULLIF(m, n) AS nulled, NULLIF(m, n)['b'] AS value FROM t;
```
Produces
```
+--------------+-------+
| nulled | value |
+--------------+-------+
| NULL | 2 |
| {a: 3, b: 4} | 4 |
+--------------+-------+
```
### Expected behavior
```
+--------------+-------+
| nulled | value |
+--------------+-------+
| NULL | NULL |
| {a: 3, b: 4} | 4 |
+--------------+-------+
```
### Additional context
_No response_
--
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]