File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 133
133
(= attrs-a attrs-b)
134
134
(Relation. attrs-a (into (vec tuples-a) tuples-b))
135
135
136
- (not (same-keys? attrs-a attrs-b))
136
+ (and (not (same-keys? attrs-a attrs-b))
137
+ (seq tuples-a) ; could be empty because
138
+ (seq tuples-b)) ; a query short-circuited
137
139
(raise " Can’t sum relations with different attrs: " attrs-a " and " attrs-b
138
140
{:error :query/where })
139
141
Original file line number Diff line number Diff line change 81
81
(or-join [?e]
82
82
(and [?e :age ?a]
83
83
[?e2 :age ?a]))]
84
- #{1 2 3 4 5 6 })
84
+ #{1 2 3 4 5 6 }
85
+
86
+ [(or-join [?e ?n]
87
+ (and [?e :age 30 ] ; no matches, so this branch short-circuits
88
+ [?e :name ?n])
89
+ (and [?e :age 20 ]
90
+ [?e :name ?n]))
91
+ [(ground " Ivan" ) ?n]]
92
+ #{2 6 }
93
+
94
+ [(or
95
+ (and [?e :age 30 ] ; no matches, so this branch short-circuits
96
+ [?e :name ?n])
97
+ (and [?e :age 20 ]
98
+ [?e :name ?n]))
99
+ [(ground " Ivan" ) ?n]]
100
+ #{2 6 })
85
101
86
102
; ; #348
87
103
(is (= #{[1 ] [3 ] [4 ] [5 ]}
184
200
(d/q '[:find ?e
185
201
:where (or-join [[?e]]
186
202
[?e :name " Ivan" ])]
187
- @test-db))))
203
+ @test-db))))
You can’t perform that action at this time.
0 commit comments