wanglingsong / JsonSurfer

A streaming JsonPath processor in Java
MIT License
294 stars 55 forks source link

Results do not match other implementations #60

Open cburgmer opened 4 years ago

cburgmer commented 4 years ago

The following queries provide results that do not match those of other implementations of JSONPath (compare https://cburgmer.github.io/json-path-comparison/):

For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Java_com.github.jsurfer.

wanglingsong commented 4 years ago

I can try to fix the last case first

wanglingsong commented 4 years ago

Due to the streaming nature of JsonSurfer, Case 2 and 3 with negative step are very hard to implement

cburgmer commented 4 years ago

Just out of curiosity, for a query $[-n] you could keep a window with n entries. When the stream stops you pick the first entry from that window and have your candidate. The upper memory limit for the window would depend on the size of the entries in the list you are processing. This is very likely no different to what you are currently doing, just n times (= constant) more.

wanglingsong commented 4 years ago

Cool. It does make sense. I will try.

wanglingsong commented 4 years ago

I've just reviewed source code and couldn't figure out a quick fix. So Case 2 & 3 won't be supported in near release