Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions crates/core/src/subscription/module_subscription_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ mod tests {

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

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

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

// Results in a no-op
assert_tx_update_for_table(&mut rx, u_id, &schema, [], []).await;

// We should only have evaluated the query for `x = 5`
assert_eq!(metrics.delta_queries_evaluated, 1);
assert_eq!(metrics.delta_queries_matched, 1);
assert_eq!(metrics.delta_queries_matched, 0);

Ok(())
}
Expand Down
15 changes: 14 additions & 1 deletion crates/execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,25 @@ pub trait DeltaStore {
}
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Clone)]
Comment thread
jsdt marked this conversation as resolved.
pub enum Row<'a> {
Ptr(RowRef<'a>),
Ref(&'a ProductValue),
}

impl PartialEq for Row<'_> {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Ptr(x), Self::Ptr(y)) => x == y,
(Self::Ref(x), Self::Ref(y)) => x == y,
(Self::Ptr(x), Self::Ref(y)) => x == *y,
(Self::Ref(x), Self::Ptr(y)) => y == *x,
}
}
}

impl Eq for Row<'_> {}

impl Hash for Row<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
Expand Down
Loading