Skip to content
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

Fix bug for FILTER with negated expressions #1587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hannahbast
Copy link
Member

For expression results represented as a set of intervals, negation can lead to an "infinitely" large interval end. This was not adequately handled in the implementation of FILTER, which led to a vector::reserve exception. This is now fixed. Use the occasion to improve the documentation of the code.

For expression results represented as a set of intervals, negation can
lead to an "infinitely" large interval end. This was not adequately
handled in the implementation of `FILTER`, which led to a
`vector::reserve` exception. This is now fixed. Use the occasion to
improve the documentation of the code.
@sparql-conformance
Copy link

Conformance check passed ✅

Test Status Changes 📊

Number of Tests Previous Status Current Status
1 Failed Passed

Details: https://qlever.cs.uni-freiburg.de/sparql-conformance-ui?cur=253d5b732bea41496b7b524811808e4a461d4e1f&prev=d46e69a2b043c4f0df6586eee29d081d4b58dd0d

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.05%. Comparing base (2ccfb50) to head (253d5b7).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/engine/Filter.cpp 88.23% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1587      +/-   ##
==========================================
+ Coverage   89.04%   89.05%   +0.01%     
==========================================
  Files         368      368              
  Lines       33972    34047      +75     
  Branches     3839     3846       +7     
==========================================
+ Hits        30249    30321      +72     
  Misses       2471     2471              
- Partials     1252     1255       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@RobinTF RobinTF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, this bug must've been there for ages unnoticed.
I think it's kind of odd that the values are clamped in two loops, but I'm not sure if there's a better way. Maybe a foreach at the start that does it once? Not sure if that helps readability though. Regardless it would be nice having a unit test testing this exact bug to prevent future regressions.

Copy link

sonarcloud bot commented Oct 26, 2024

@hannahbast
Copy link
Member Author

@RobinTF The reason for having to do this twice in the code is simple: The first part counts the size of the result (so that we can reserve the appropriate amount of space), the second part computes it.

A cleaner solution would be to avoid having these "infinite" interval ends in the first place. But Johannes and I figured that would take more work. What you see here is the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants