avoid tag-translating in filter optimizer, fixes crash when filters contains a non-existent tag #363
Merged
Merged
Conversation
205aaac to
f7ed1ca
Compare
joker234
reviewed
Mar 23, 2021
Member
joker234
left a comment
There was a problem hiding this comment.
So basically, apart from some reformatting and prettyfying the code, the change is to use OSHDBTag and OSHDBTagKey directly instead of translating it to OSMTag or OSMTagKey objects first? This prevents the translator to fail and we can return an empty response?
Member
Author
Exactly. |
joker234
previously approved these changes
Mar 23, 2021
to avoid deprecation warning where it is used internally, and will not be removed from the class
f7ed1ca to
61ed94a
Compare
456f850 to
8ff4de5
Compare
joker234
approved these changes
Mar 23, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A oshdb filter goes through some optimization steps for increased performance, e.g. for simple
key=valuequeries, it will use a more efficient code path than for example a filter likekey1=value1 or key2=value2. The "fast" path crashed, when a non-existent tag is contained in the filter: The code tries to convert the tag from the OSHDB-internal representation back to strings. This normally works fine, but not for tags which don't exist.This fixes the bug by replacing the conversion from tag ids to strings by a newly added private method for using tag ids directly for filtering.
This PR also fixes a few minor typos (
entitiy->entity) and refactors some of theosmTagfilters slightly (to also use the new helper method and be more similar to each other).Corresponding issue
Closes GIScience/ohsome-api#154
Checklist
I have written javadoc (required for public methods)I have made corresponding changes to the documentationI have adjusted the examples or created an issue in the corresponding repositoryI have adjusted the benchmark or created an issue in the corresponding repository