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
1 change: 0 additions & 1 deletion differential-dataflow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ readme = "../README.md"
edition="2021"

[dev-dependencies]
indexmap = "2.1"
rand="0.4"
itertools="^0.13"
graph_map = "0.1"
Expand Down
25 changes: 12 additions & 13 deletions differential-dataflow/examples/graspan.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::collections::BTreeMap;
use std::io::{BufRead, BufReader};
use std::fs::File;

use indexmap::IndexMap;

use timely::progress::Timestamp;
use timely::order::Product;
use timely::dataflow::Scope;
Expand Down Expand Up @@ -152,12 +151,12 @@ impl Query {
}

/// Creates a dataflow implementing the query, and returns input and trace handles.
pub fn render_in<G>(&self, scope: &mut G) -> IndexMap<String, RelationHandles<G::Timestamp>>
pub fn render_in<G>(&self, scope: &mut G) -> BTreeMap<String, RelationHandles<G::Timestamp>>
where
G: Scope<Timestamp: Lattice+::timely::order::TotalOrder>,
{
// Create new input (handle, stream) pairs
let mut input_map = IndexMap::new();
let mut input_map = BTreeMap::new();
for production in self.productions.iter() {
input_map.entry(production.left_hand.clone()).or_insert_with(|| scope.new_collection());
}
Expand All @@ -166,11 +165,11 @@ impl Query {
scope.iterative::<Iter,_,_>(|subscope| {

// create map from relation name to input handle and collection.
let mut result_map = IndexMap::new();
let mut variable_map = IndexMap::new();
let mut result_map = BTreeMap::new();
let mut variable_map = BTreeMap::new();

// create variables and result handles for each named relation.
for (name, (input, collection)) in input_map.drain(..) {
for (name, (input, collection)) in input_map {
let edge_variable = EdgeVariable::from(&collection.enter(subscope), Product::new(Default::default(), 1));
let trace = edge_variable.variable.leave().arrange_by_self().trace;
result_map.insert(name.clone(), RelationHandles { input, trace });
Expand All @@ -188,14 +187,14 @@ impl Query {

// We'll track the path transposed, so that it is indexed by *destination* rather than source.
let mut transposed = match &rule[0] {
Relation::Forward(name) => variable_map[name].reverse().clone(),
Relation::Reverse(name) => variable_map[name].forward().clone(),
Relation::Forward(name) => variable_map.get_mut(name).unwrap().reverse().clone(),
Relation::Reverse(name) => variable_map.get_mut(name).unwrap().forward().clone(),
};

for relation in rule[1..].iter() {
let to_join = match relation {
Relation::Forward(name) => variable_map[name].forward(),
Relation::Reverse(name) => variable_map[name].reverse(),
Relation::Forward(name) => variable_map.get_mut(name).unwrap().forward(),
Relation::Reverse(name) => variable_map.get_mut(name).unwrap().reverse(),
};

transposed =
Expand All @@ -205,11 +204,11 @@ impl Query {
}

// Reverse the direction before adding it as a production.
variable_map[name].add_production(&transposed.as_collection(|&dst,&src| (src,dst)));
variable_map.get_mut(name).unwrap().add_production(&transposed.as_collection(|&dst,&src| (src,dst)));
}
}

for (_name, variable) in variable_map.drain(..) {
for (_name, variable) in variable_map {
variable.complete();
}
result_map
Expand Down
1 change: 0 additions & 1 deletion doop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ edition = "2021"
publish = false

[dependencies]
indexmap = "2.1"
timely = {workspace = true}
differential-dataflow = { workspace = true }