-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable to pass a list of jsonpointers like to whitelist/blacklist in jsonparser #235
Comments
This is an intriguing idea. The set of pointers could determine whether or not the parser automatically skips over events. Might be tricky to specify this in a non-ambiguous way, though, in the face of contradictory whitelist/blacklists. |
Parsers should already be able to skip allocating memory for events that are not consumed by the caller. I see no advantage to pushing query processing or redaction inside the parser. |
Spec defines JsonPointer, if a set can be passed to the parser then it sounds easy to impl and configure. |
No, there is also skipObject() and skipArray(). And there is no requirement that next() has to materialize anything. Materialization can be postponed until getXXX is actually called. |
I don't think memory consumption is the real concern here. Skipping is implied when That being said, I could definitely see |
There is a requirement to materialize next by design, you cant impl getString if you didnt stored it somewhere - mem, disk, ... - so requirement is built in. For ex, you cant skip an event string value today, even if you know it does 10g (yes xml in json but it exists). SkipTo is ok but id expect more a jsonParserFactory.createParser(...., new JsonPointer[]{....}) to be able to pass multiple ones |
The ability to evaluate JsonPointer over JsonParser is reasonable but I don't think this should be added to the parser api. The parser api should remain independent of specific path evaluation languages. There is no reason this functionality can't be implemented outside of the parser. And the premise that next() requires string materialization is not correct. |
@rmannibucau A parser can basically tell by the first character what the event is. No need to move any further until asked to. If @jjspiegel That makes sense. Something like |
No, even not called value is materialized - at least in byte[], check out all impl out there. API requires it by its design so parser api cant read some document it should and jsonb cant support some mapping it could forking jsonp. |
When you know what you read, passing some whitelist/blacklist of parser events to skip can enable to reduce memory consumption and optimize the execution.
This is somehow related to jakartaee/jsonb-api#224 (comment)
Side note: can need to generalize jsonpointer syntax to support wildcards for arrays.
The text was updated successfully, but these errors were encountered: