@@ -135,7 +135,8 @@ impl PathToJoinsRule {
135
135
. reduce ( |lhs, rhs| or ( lhs, rhs) )
136
136
. expect ( "There must be at least one element in the negated property set." ) ;
137
137
138
- self . scan_quads ( graph, Some ( not ( test_expression) ) )
138
+ let paths = self . scan_quads ( graph, Some ( not ( test_expression) ) ) ?;
139
+ make_distinct ( paths)
139
140
}
140
141
141
142
/// Reverses the inner path by swapping [COL_SOURCE] and [COL_TARGET].
@@ -173,7 +174,7 @@ impl PathToJoinsRule {
173
174
) -> DFResult < LogicalPlanBuilder > {
174
175
let lhs = self . rewrite_property_path_expression ( graph, lhs) ?;
175
176
let rhs = self . rewrite_property_path_expression ( graph, rhs) ?;
176
- join_path_sequence ( lhs, rhs)
177
+ make_distinct ( join_path_sequence ( lhs, rhs) ? )
177
178
}
178
179
179
180
/// Rewrites a zero or more to a CTE.
@@ -184,7 +185,8 @@ impl PathToJoinsRule {
184
185
) -> DFResult < LogicalPlanBuilder > {
185
186
let zero = self . zero_length_paths ( graph) ?;
186
187
let repetition = self . rewrite_one_or_more ( graph, inner) ?;
187
- join_path_alternatives ( zero, repetition)
188
+ let paths = join_path_alternatives ( zero, repetition) ?;
189
+ make_distinct ( paths)
188
190
}
189
191
190
192
/// Rewrites a one or more by building a recursive query.
@@ -308,6 +310,14 @@ fn join_path_alternatives(
308
310
309
311
/// Makes the path set distinct.
310
312
fn make_distinct ( builder : LogicalPlanBuilder ) -> DFResult < LogicalPlanBuilder > {
313
+ // TODO: Behavior is weird for pp02 and pp12. The missing results are present.
314
+ // E.g., Result for pp02:
315
+ //
316
+ // Note: missing solutions in yellow and extra solutions in blue
317
+ // {?x = <http://www.example.org/instance#a> }
318
+ // {?x = <http://www.example.org/instance#a> }
319
+ // {?x = <http://www.example.org/instance#a> }
320
+ // {?x = <http://www.example.org/instance#c> }
311
321
builder. distinct_on (
312
322
vec ! [
313
323
ENC_WITH_SORTABLE_ENCODING . call( vec![ col( COL_GRAPH ) ] ) ,
0 commit comments