Skip to content

Commit c8e5614

Browse files
committed
refactor(optimizer): remove unused ColumnTopN merge API
1 parent 180b40e commit c8e5614

1 file changed

Lines changed: 0 additions & 45 deletions

File tree

src/optimizer/core/top_n.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ impl ColumnTopN {
7070
self.add_with_options(top_n_size, value, count, 0);
7171
}
7272

73-
pub fn merge_with_size(&mut self, other: ColumnTopN, top_n_size: usize) {
74-
for entry in other.values {
75-
if self.should_insert(&entry.value, entry.count, entry.error) {
76-
self.insert_new_with_options(top_n_size, entry);
77-
}
78-
}
79-
}
80-
8173
pub fn finish_with_size(mut self, top_n_size: usize) -> Self {
8274
self.prune_to_capacity(top_n_size);
8375
self
@@ -269,43 +261,6 @@ mod tests {
269261
assert_eq!(entry.error(), 1);
270262
}
271263

272-
#[test]
273-
fn top_n_merge_accumulates_entries() {
274-
let mut left = ColumnTopN::default();
275-
left.add_with_size(2, DataValue::Int32(1), 3);
276-
left.add_with_size(2, DataValue::Int32(2), 2);
277-
278-
let mut right = ColumnTopN::default();
279-
right.add_with_size(2, DataValue::Int32(1), 4);
280-
right.add_with_size(2, DataValue::Int32(3), 1);
281-
282-
left.merge_with_size(right, 2);
283-
284-
assert_eq!(left.get(&DataValue::Int32(1)), Some(7));
285-
assert_eq!(left.len(), 2);
286-
}
287-
288-
#[test]
289-
fn top_n_merge_records_error_for_absent_entries() {
290-
let mut left = ColumnTopN::default();
291-
left.add_with_size(2, DataValue::Int32(1), 5);
292-
left.add_with_size(2, DataValue::Int32(2), 3);
293-
294-
let mut right = ColumnTopN::default();
295-
right.add_with_size(2, DataValue::Int32(3), 4);
296-
right.add_with_size(2, DataValue::Int32(4), 1);
297-
298-
left.merge_with_size(right, 2);
299-
300-
assert_eq!(left.len(), 2);
301-
let entry = left.get_entry(&DataValue::Int32(3)).unwrap();
302-
assert_eq!(entry.count(), 7);
303-
assert_eq!(entry.error(), 3);
304-
let entry = left.get_entry(&DataValue::Int32(4)).unwrap();
305-
assert_eq!(entry.count(), 6);
306-
assert_eq!(entry.error(), 5);
307-
}
308-
309264
#[test]
310265
fn top_n_skips_null() {
311266
let mut top_n = ColumnTopN::default();

0 commit comments

Comments
 (0)