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
24 changes: 10 additions & 14 deletions crates/dbsp/src/operator/dynamic/input_upsert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ where
.add_binary_operator(
<InputUpsert<Spine<B>, U, B>>::new(
factories.batch_factories.clone(),
factories.opt_key_factory,
factories.opt_val_factory,
patch_func,
),
Expand Down Expand Up @@ -480,7 +479,6 @@ where
U: DataTrait + ?Sized,
{
batch_factories: B::Factories,
opt_key_factory: &'static dyn Factory<DynOpt<B::Key>>,
opt_val_factory: &'static dyn Factory<DynOpt<B::Val>>,
patch_func: PatchFunc<T::Val, U>,

Expand All @@ -501,13 +499,11 @@ where
{
pub fn new(
batch_factories: B::Factories,
opt_key_factory: &'static dyn Factory<DynOpt<B::Key>>,
opt_val_factory: &'static dyn Factory<DynOpt<B::Val>>,
patch_func: PatchFunc<T::Val, U>,
) -> Self {
Self {
batch_factories,
opt_key_factory,
opt_val_factory,
patch_func,
input_batch_stats: BatchSizeStats::new(),
Expand Down Expand Up @@ -579,7 +575,7 @@ where
B::Builder::with_capacity(&self.batch_factories, n_updates * 2, n_updates * 2);

// Current key for which we are processing updates.
let mut cur_key: Box<DynOpt<T::Key>> = self.opt_key_factory.default_box();
let mut cur_key = None;

// Current value associated with the key after applying all processed updates
// to it.
Expand All @@ -603,9 +599,9 @@ where

// We finished processing updates for the previous key. Push them to the
// builder and generate a retraction for the new key.
if cur_key.get() != Some(key) {
if cur_key != Some(key) {
// Push updates for the previous key to the builder.
if let Some(cur_key) = cur_key.get_mut() {
if let Some(cur_key) = cur_key {
if let Some(val) = cur_val.get_mut() {
key_updates.push_with(&mut |item| {
let (v, w) = item.split_mut();
Expand All @@ -625,7 +621,7 @@ where
key_updates.clear();
}

cur_key.from_ref(key);
cur_key = Some(key);
cur_val.set_none();

// Generate retraction if `key` is present in the trace.
Expand Down Expand Up @@ -670,7 +666,7 @@ where
}

// Push updates for the last key.
if let Some(cur_key) = cur_key.get_mut() {
if let Some(cur_key) = cur_key {
if let Some(val) = cur_val.get_mut() {
key_updates.push_with(&mut |item| {
let (v, w) = item.split_mut();
Expand Down Expand Up @@ -839,7 +835,7 @@ where
);

// Current key for which we are processing updates.
let mut cur_key: Box<DynOpt<T::Key>> = self.factories.opt_key_factory.default_box();
let mut cur_key = None;

// Current value associated with the key after applying all processed updates
// to it.
Expand Down Expand Up @@ -867,9 +863,9 @@ where

// We finished processing updates for the previous key. Push them to the
// builder and generate a retraction for the new key.
if cur_key.get() != Some(key) {
if cur_key != Some(key) {
// Push updates for the previous key to the builder.
if let Some(cur_key) = cur_key.get_mut() {
if let Some(cur_key) = cur_key {
if let Some(val) = cur_val.get_mut() {
key_updates.push_with(&mut |item| {
let (v, w) = item.split_mut();
Expand All @@ -890,7 +886,7 @@ where
}

skip_key = false;
cur_key.from_ref(key);
cur_key = Some(key);
cur_val.set_none();

// Generate retraction if `key` is present in the trace.
Expand Down Expand Up @@ -970,7 +966,7 @@ where
}

// Push updates for the last key.
if let Some(cur_key) = cur_key.get_mut() {
if let Some(cur_key) = cur_key {
if let Some(val) = cur_val.get_mut() {
key_updates.push_with(&mut |item| {
let (v, w) = item.split_mut();
Expand Down
4 changes: 4 additions & 0 deletions crates/dbsp/src/trace/cursor/cursor_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ where
fn seek_key_exact(&mut self, key: &K, hash: Option<u64>) -> bool {
self.set_key_direction(None);

if self.cursors.is_empty() {
return false;
}

let hash = hash.unwrap_or_else(|| key.default_hash());
self.current_key.clear();

Expand Down
17 changes: 14 additions & 3 deletions crates/dbsp/src/trace/ord/vec/indexed_wset_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,20 @@ where
O: OrdOffset,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VecIndexedWSet")
.field("layer", &self.layer)
.finish()
writeln!(f, "VecIndexedWSet:")?;
let mut cursor = self.cursor();
while let Some(key) = cursor.get_key() {
writeln!(f, " key {key:?}:")?;
while let Some(val) = cursor.get_val() {
writeln!(f, " value {val:?}:")?;
cursor.map_times(&mut |time, diff| {
let _ = writeln!(f, " ({time:?}, {diff:?})");
});
cursor.step_val();
}
cursor.step_key();
}
Ok(())
}
}

Expand Down
Loading