Skip to content

Commit 3dfda8f

Browse files
authored
don't panic if eq class is not found (#60)
1 parent e206db5 commit 3dfda8f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/rewrite/normal_form.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,19 @@ impl Predicate {
496496
let range = self
497497
.eq_class_idx_by_column
498498
.get(c)
499-
.and_then(|&idx| self.ranges_by_equivalence_class.get_mut(idx))
500-
.unwrap();
499+
.ok_or_else(|| {
500+
DataFusionError::Plan(format!("column {c} not found in equivalence classes"))
501+
})
502+
.and_then(|&idx| {
503+
self.ranges_by_equivalence_class
504+
.get_mut(idx)
505+
.ok_or_else(|| {
506+
DataFusionError::Plan(format!(
507+
"range not found class not found for column {c} with equivalence class {:?}", self.eq_classes.get(idx)
508+
))
509+
})
510+
})?;
511+
501512
let new_range = match op {
502513
Operator::Eq => Interval::try_new(value.clone(), value.clone()),
503514
Operator::LtEq => {

0 commit comments

Comments
 (0)