Skip to content

Commit 44168f1

Browse files
Replace IndexMap with BTreeMap (#652)
1 parent b19ff4b commit 44168f1

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

differential-dataflow/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ readme = "../README.md"
1616
edition="2021"
1717

1818
[dev-dependencies]
19-
indexmap = "2.1"
2019
rand="0.4"
2120
itertools="^0.13"
2221
graph_map = "0.1"

differential-dataflow/examples/graspan.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
use std::collections::BTreeMap;
12
use std::io::{BufRead, BufReader};
23
use std::fs::File;
34

4-
use indexmap::IndexMap;
5-
65
use timely::progress::Timestamp;
76
use timely::order::Product;
87
use timely::dataflow::Scope;
@@ -152,12 +151,12 @@ impl Query {
152151
}
153152

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

168167
// create map from relation name to input handle and collection.
169-
let mut result_map = IndexMap::new();
170-
let mut variable_map = IndexMap::new();
168+
let mut result_map = BTreeMap::new();
169+
let mut variable_map = BTreeMap::new();
171170

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

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

195194
for relation in rule[1..].iter() {
196195
let to_join = match relation {
197-
Relation::Forward(name) => variable_map[name].forward(),
198-
Relation::Reverse(name) => variable_map[name].reverse(),
196+
Relation::Forward(name) => variable_map.get_mut(name).unwrap().forward(),
197+
Relation::Reverse(name) => variable_map.get_mut(name).unwrap().reverse(),
199198
};
200199

201200
transposed =
@@ -205,11 +204,11 @@ impl Query {
205204
}
206205

207206
// Reverse the direction before adding it as a production.
208-
variable_map[name].add_production(&transposed.as_collection(|&dst,&src| (src,dst)));
207+
variable_map.get_mut(name).unwrap().add_production(&transposed.as_collection(|&dst,&src| (src,dst)));
209208
}
210209
}
211210

212-
for (_name, variable) in variable_map.drain(..) {
211+
for (_name, variable) in variable_map {
213212
variable.complete();
214213
}
215214
result_map

doop/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ edition = "2021"
66
publish = false
77

88
[dependencies]
9-
indexmap = "2.1"
109
timely = {workspace = true}
1110
differential-dataflow = { workspace = true }

0 commit comments

Comments
 (0)