Skip to content

Commit 5770386

Browse files
Fix equality comparison between Row::Ptr and Row::Ref (#2914)
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
1 parent 3907591 commit 5770386

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

crates/core/src/subscription/module_subscription_actor.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ mod tests {
23012301

23022302
// We should have evaluated queries for `x = 3` and `x = 4`
23032303
assert_eq!(metrics.delta_queries_evaluated, 2);
2304-
assert_eq!(metrics.delta_queries_matched, 2);
2304+
assert_eq!(metrics.delta_queries_matched, 1);
23052305

23062306
// UPDATE v SET x = 0 WHERE id = 3
23072307
let metrics = commit_tx(
@@ -2319,19 +2319,17 @@ mod tests {
23192319

23202320
// Insert new row into `u` that joins with `x = 5`
23212321
// UPDATE v SET x = 6 WHERE id = 5
2322+
// Should result in a no-op
23222323
let metrics = commit_tx(
23232324
&db,
23242325
&subs,
23252326
[(v_id, product![5u64, 5u64, 5u64])],
23262327
[(v_id, product![5u64, 6u64, 6u64]), (u_id, product![5u64, 6u64, 7u64])],
23272328
)?;
23282329

2329-
// Results in a no-op
2330-
assert_tx_update_for_table(&mut rx, u_id, &schema, [], []).await;
2331-
23322330
// We should only have evaluated the query for `x = 5`
23332331
assert_eq!(metrics.delta_queries_evaluated, 1);
2334-
assert_eq!(metrics.delta_queries_matched, 1);
2332+
assert_eq!(metrics.delta_queries_matched, 0);
23352333

23362334
Ok(())
23372335
}

crates/execution/src/lib.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,25 @@ pub trait DeltaStore {
115115
}
116116
}
117117

118-
#[derive(Clone, PartialEq, Eq)]
118+
#[derive(Clone)]
119119
pub enum Row<'a> {
120120
Ptr(RowRef<'a>),
121121
Ref(&'a ProductValue),
122122
}
123123

124+
impl PartialEq for Row<'_> {
125+
fn eq(&self, other: &Self) -> bool {
126+
match (self, other) {
127+
(Self::Ptr(x), Self::Ptr(y)) => x == y,
128+
(Self::Ref(x), Self::Ref(y)) => x == y,
129+
(Self::Ptr(x), Self::Ref(y)) => x == *y,
130+
(Self::Ref(x), Self::Ptr(y)) => y == *x,
131+
}
132+
}
133+
}
134+
135+
impl Eq for Row<'_> {}
136+
124137
impl Hash for Row<'_> {
125138
fn hash<H: Hasher>(&self, state: &mut H) {
126139
match self {

0 commit comments

Comments
 (0)