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

Support empty transitive path #1835

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RobinTF
Copy link
Collaborator

@RobinTF RobinTF commented Feb 25, 2025

Do not merge before #1834 and #1824, otherwise this will result in bad performance and OOM crashes.

Fixes #1780

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.21%. Comparing base (8fe0642) to head (3fc85cd).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1835      +/-   ##
==========================================
+ Coverage   90.18%   90.21%   +0.02%     
==========================================
  Files         400      400              
  Lines       38440    38472      +32     
  Branches     4306     4309       +3     
==========================================
+ Hits        34666    34706      +40     
+ Misses       2479     2468      -11     
- Partials     1295     1298       +3     

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

@sparql-conformance
Copy link

Conformance check passed ✅

Test Status Changes 📊

Number of Tests Previous Status Current Status
4 Failed Passed

Details: https://qlever.cs.uni-freiburg.de/sparql-conformance-ui?cur=3fc85cdaebd74515f28a48e18579a826f4e53de0&prev=8fe06428ee1dddbb3ebcb41a1d93525075571bc1

Copy link

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

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

A first pass on everything but the TransitivePathTests.

@@ -2535,8 +2535,12 @@ void QueryPlanner::GraphPatternPlanner::visitTransitivePath(
right.value_ = getSideValue(arg._right);
size_t min = arg._min;
size_t max = arg._max;
if (planner_.activeGraphVariable_.has_value()) {
AD_THROW("Property paths with graph variables are not supported");
Copy link
Member

Choose a reason for hiding this comment

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

not AD_THROW but simply throw
(it is not a bug, but an unsupported feature)
and it should read Property paths inside a GRAPH clause with a graph variable are....

Comment on lines +47 to +48
if (minDist_ == 0 && !lhs_.isBoundVariable() && !rhs_.isBoundVariable() &&
lhs_.isVariable() && rhs_.isVariable()) {
Copy link
Member

Choose a reason for hiding this comment

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

Refactor is to lhs_.isUnboundVariable for the readability.

Comment on lines +70 to +71
auto uniqueValues = ad_utility::makeExecutionTree<Distinct>(
qec, QueryExecutionTree::createSortedTree(std::move(allValues), {0}),
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't the constructor of distinct perform the createSortedTree automatically?

Copy link
Member

Choose a reason for hiding this comment

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

If not, it definitely should...
Fix this either here or (better) in a separate PR.

@@ -14,10 +14,10 @@
TransitivePathHashMap::TransitivePathHashMap(
QueryExecutionContext* qec, std::shared_ptr<QueryExecutionTree> child,
TransitivePathSide leftSide, TransitivePathSide rightSide, size_t minDist,
size_t maxDist)
size_t maxDist, Graphs activeGraphs)
Copy link
Member

Choose a reason for hiding this comment

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

If all these inheriting classes have no exclusive state, but only share the members of the base class, just with different implementations,
then you can get rid of the explicitly + redundantly reimplemented constructors and just to
using BaseClass::BaseClass to pull in the constructors of the base.

Copy link
Member

Choose a reason for hiding this comment

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

(If true, this comment probably holds for multiple classes that start with TransitivePath...

@@ -2981,3 +2981,53 @@ TEST(QueryPlanner, Exists) {
"GRAPH ?g { ?u ?v ?c}}}",
filter);
}

// _____________________________________________________________________________
TEST(QueryPlanner, PropertyPathWithGraph) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you have a test cases for a non-empty transitive path, e.g.

SELECT * FROM <g> { ?x <blubb>+ ?y }

This case should also correctly forward the graph constraint to the index scan for <blubb>.

@@ -2981,3 +2981,53 @@ TEST(QueryPlanner, Exists) {
"GRAPH ?g { ?u ?v ?c}}}",
filter);
}

// _____________________________________________________________________________
TEST(QueryPlanner, PropertyPathWithGraph) {
Copy link
Member

Choose a reason for hiding this comment

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

This test case mixes "property path with graph" and "empty property path": ,
at least adjust the names.

@@ -420,6 +421,9 @@ constexpr auto OrderBy = [](const ::OrderBy::SortedVariables& sortedVariables,
// Match a `UNION` operation.
constexpr auto Union = MatchTypeAndOrderedChildren<::Union>;

// Match a `DISTINCT` operation.
constexpr auto Distinct = MatchTypeAndOrderedChildren<::Distinct>;
Copy link
Member

Choose a reason for hiding this comment

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

The DISTINCT class also has the state of the selected/relevant variables.
Those should also be reflected in the matcher appropriately.

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.

Support empty property path.
2 participants