Describe the bug
Collecting a missing key into an array normally produces [null],
but inside a select/and/or condition the missing key is dropped.
Version of yq: 4.53.3
Operating system: mac
Installed via: built from source
Command
yq -n '{} | ([.a] | length)' # 1 (ok)
yq -n '{} | select([.a] | length == 1)' # no output (expected {})
yq -n '{} | (true and ([.a] | length == 1))' # false (expected true)
Actual behaviour
$ yq -n '{} | ([.a] | length)'
1
$ yq -n '{} | select([.a] | length == 1)'
$ yq -n '{} | select([.a] | length == 1)' | wc -c
0
$ yq -n '{} | (true and ([.a] | length == 1))'
false
Expected behaviour
[.a] should be [null] (length 1) everywhere, as it is at the top level (and as in jq):
Additional context
The case in which I actually became aware of this issue was a bit more complex,
But I got advice from Claude and Codex when creating the minimal reproduction case.
Describe the bug
Collecting a missing key into an array normally produces [null],
but inside a select/and/or condition the missing key is dropped.
Version of yq: 4.53.3
Operating system: mac
Installed via: built from source
Command
Actual behaviour
Expected behaviour
[.a] should be [null] (length 1) everywhere, as it is at the top level (and as in jq):
Additional context
The case in which I actually became aware of this issue was a bit more complex,
But I got advice from Claude and Codex when creating the minimal reproduction case.