MiSawa / xq

Pure rust implementation of jq
MIT License
333 stars 18 forks source link

Term suffices iterator differences #55

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

It seems that iterators in term suffices is evaluated in different order than jq.

❯ jq -n '[range(4)][0,1:][0,2]'
0
1
2
3

❯ xq -n '[range(4)][0,1:][0,2]'
0
2
1
3

❯ xq --version
xq 0.1.9-dcd6c4a024b54b3b2d0dc7ed90a349d42c11aa67

There are various queries (e.x. jq '.b[]."\(.a[])"' <<< '{ "a": [0,1], "b": [{"0":1,"1":2},{"0":3,"1":4}] }') to hit this difference but the above query is the simplest one.

MiSawa commented 2 years ago

Thank you for the report! Fixed in #59 but I guess there are probably other things that has a similar evaluation ordering issue.