fix: unknown filter should return empty set #663
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.
While working on a conversion filter, I was surprised by the results: they had a tendency to be really good while I was expecting low results. I realised that if one of the facet in the filter is not defined on the DataChunks, it is ignored. This leads to super good results while it is just a misconfiguration of the filter. As a consumer of the cruncher, I did not know I was using the filter incorrectly, especially when you start combining multiple of them and you get already a subset of the results, it is impossible to know one is invalid and just ignored.
I think it makes more sense to return no result (and log an error) if someone is trying to filter on something which is not defined. This is much more intuitive.
One of the existing test
DataChunk.filter(userAgent)
has the problem: it filters onhost
whilehost
is not defined... The test was incomplete, if you filter byhost
, you need to have input data with different hosts to make sure you are testing thehost
filter. This would have reveal the "issue" or showcase this is a desired behaviour.