Skip to content

Commit

Permalink
perf(hash join): do not store null rows (close risingwavelabs#9009) (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
soundOfDestiny authored Apr 6, 2023
1 parent 110972a commit 3091f16
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions src/stream/src/executor/hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,18 +1107,22 @@ impl<K: HashKey, S: StateStore, const T: JoinTypePrimitive> HashJoinExecutor<K,
side_match.ht.delete_row(key, matched_row.row);
}
}
} else if let Some(chunk) =
hashjoin_chunk_builder.forward_if_not_matched(Op::Insert, row)
{
yield chunk;
}

if append_only_optimize && let Some(row) = append_only_matched_row {
side_match.ht.delete(key, row);
} else if side_update.need_degree_table {
side_update.ht.insert(key, JoinRow::new(row, degree)).await?;
if append_only_optimize && let Some(row) = append_only_matched_row {
side_match.ht.delete(key, row);
} else if side_update.need_degree_table {
side_update.ht.insert(key, JoinRow::new(row, degree)).await?;
} else {
side_update.ht.insert_row(key, row).await?;
}
} else {
side_update.ht.insert_row(key, row).await?;
// Row which violates null-safe bitmap will never be matched so we need not
// store.
if let Some(chunk) =
hashjoin_chunk_builder.forward_if_not_matched(Op::Insert, row)
{
yield chunk;
}
}
}
Op::Delete | Op::UpdateDelete => {
Expand Down Expand Up @@ -1200,18 +1204,22 @@ impl<K: HashKey, S: StateStore, const T: JoinTypePrimitive> HashJoinExecutor<K,
side_match.ht.delete_row(key, matched_row.row);
}
}
} else if let Some(chunk) =
hashjoin_chunk_builder.forward_if_not_matched(Op::Delete, row)
{
yield chunk;
}
if append_only_optimize {
unreachable!();
} else if side_update.need_degree_table {
side_update.ht.delete(key, JoinRow::new(row, degree));

if append_only_optimize {
unreachable!();
} else if side_update.need_degree_table {
side_update.ht.delete(key, JoinRow::new(row, degree));
} else {
side_update.ht.delete_row(key, row);
};
} else {
side_update.ht.delete_row(key, row);
};
// We do not store row which violates null-safe bitmap.
if let Some(chunk) =
hashjoin_chunk_builder.forward_if_not_matched(Op::Delete, row)
{
yield chunk;
}
}
}
}
}
Expand Down

0 comments on commit 3091f16

Please sign in to comment.