zed
zed copied to clipboard
coerce key in map lookup
Right now, map lookups return missing if the lookup value does not exactly match the type of the map key. This should be more robust with coercion etc.
Here's my attempt at a repro with Zed commit 7396ea9.
$ cat repro.zson
{
m: |{
1: "a",
2: "b",
3: "c"
}|
}
$ zq -version
Version: v1.2.0-97-g7396ea9c
$ zq -Z 'yield m[2]' repro.zson
"b"
$ zq -Z 'yield m[2.0]' repro.zson
error("missing")
$ zq -Z 'yield m[uint64(2)]' repro.zson
error("missing")
I found what looks like a separate map bug while reproducing this one, so I've opened #4167 to track it.