Skip to content

Don't drop FILTER operations with unbound variables #2103

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

Merged
merged 6 commits into from
Jun 17, 2025

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Jun 4, 2025

So far, QLever silently dropped FILTER operations that referred to variables that were unbound in the respective group graph pattern. This is now fixed. For example, the following query now has an empty result as it should:

SELECT * {
  BIND (3 as ?a)
  FILTER (?a < ?b)
}

joka921 added 3 commits June 4, 2025 11:44
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
First feed this to the conformance tests, then write unit tests.

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
First feed this to the conformance tests, then write unit tests.

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
@RobinTF
Copy link
Collaborator

RobinTF commented Jun 4, 2025

@joka921 Can you check if this also fixes #1997 by any chance? I believe it is the same kind of issue.

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

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

Project coverage is 91.19%. Comparing base (641dc74) to head (ff78e9e).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/engine/QueryPlanner.cpp 94.44% 0 Missing and 1 partial ⚠️
src/engine/idTable/IdTable.h 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2103      +/-   ##
==========================================
- Coverage   91.20%   91.19%   -0.01%     
==========================================
  Files         434      434              
  Lines       42609    42617       +8     
  Branches     4805     4807       +2     
==========================================
+ Hits        38860    38866       +6     
  Misses       2348     2348              
- Partials     1401     1403       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joka921 joka921 marked this pull request as ready for review June 4, 2025 17:54
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.

The code looks good mostly, but I'd like to see an explanation for me to understand the changes a little better

void QueryPlanner::applyFiltersIfPossible(
vector<SubtreePlan>& row, const vector<SparqlFilter>& filters) const {
static_assert(!alsoApplyIfMissingVariables || replace);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If these options are somewhat exclusive, wouldn't it make sense to have an enum with 3 modes instead?
Also what I haven't understood, why is this even a template parameter in the first place? Does this justify the compilation overhead?

@@ -185,6 +185,43 @@ TEST(Union, ensurePermutationIsAppliedCorrectly) {
}
}

// _____________________________________________________________________________
TEST(Union, inputWithZeroColumns) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is of course an important edge case to consider, but I don't get how this is related to unbound variables. Please enlighten me

joka921 added 2 commits June 17, 2025 07:24
# Conflicts:
#	test/QueryPlannerTest.cpp
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
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.

Thank you very much

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
@hannahbast hannahbast changed the title Don't drop filters with unbound variables Don't drop FILTER operations with unbound variables Jun 17, 2025
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this fix! I tested this and it worked fine. I slightly revised the title and the description. In QueryPlanner.cpp:1338 not all possible outcomes are covered by tests yet. Is this a regression, @joka921, or was this already the case in the previous code?

@joka921
Copy link
Member Author

joka921 commented Jun 17, 2025

@hannahbast
That is no regression, rather an artifact of the way the coverage tool works.
Feel free to merge this.

Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

According to @joka921, the CodeCov complaint was an artifact, so I will merge this now.

@hannahbast hannahbast merged commit b8517f5 into ad-freiburg:master Jun 17, 2025
18 of 19 checks passed
Copy link

@sparql-conformance
Copy link

Conformance check failed ❌

Test Status Changes 📊

Number of Tests Previous Status Current Status
4 Passed Failed
1 Failed Passed

Details: https://qlever.cs.uni-freiburg.de/sparql-conformance-ui?cur=ff78e9e583153afd3e8b03f6fef33f601bfb1ea7&prev=4f9b0085a2573c856ae848d512f2667434d022ff

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.

3 participants