fix: Revert read_buffer table handling of column not existing

And change the test to a case that might be incorrect, but it at least
captures the current behavior
pull/24376/head
Carol (Nichols || Goulding) 2022-06-03 11:41:30 -04:00
parent aa510ae4e6
commit 7b080ca9e1
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 21 additions and 15 deletions

View File

@ -498,16 +498,7 @@ impl Table {
}
// Determine if predicate can be applied to table.
let validated_exprs = meta.validate_exprs(predicate.clone());
// If the exprs contain a column that doesn't exist in this table, then no columns can
// match. Return nothing.
if let Err(Error::ColumnDoesNotExist { .. }) = validated_exprs {
dst.clear();
return Ok(dst);
}
let predicate: Predicate = validated_exprs?.into();
let predicate: Predicate = meta.validate_exprs(predicate.clone())?.into();
// Determine if the negated predicates (deletes) can be applied to the
// table.
@ -1398,8 +1389,7 @@ mod test {
let predicate = Predicate::new(vec![BinaryExpr::from(("region", ">=", "west"))]);
assert!(table.could_pass_predicate(&predicate));
// doesn't match either row group-- the rows don't have the temp column, so they can't
// possibly match the predicate
// doesn't match either row group no column
let predicate = Predicate::new(vec![BinaryExpr::from(("temp", ">=", 0_u64))]);
assert!(!table.could_pass_predicate(&predicate));
@ -1779,7 +1769,7 @@ west,host-b,100
vec!["time".to_owned()],
);
// the column in the predicate isn't present in this table, don't return any columns
// the column in the predicate isn't present in this table, return an error
assert!(table
.column_names(
&Predicate::new(vec![BinaryExpr::from(("host", "=", "foo"))]),
@ -1787,8 +1777,24 @@ west,host-b,100
Selection::All,
BTreeSet::new(),
)
.unwrap()
.is_empty());
.is_err());
// One of the columns in the predicate doesn't exist, but the expr is `!=`, so rows in this
// table would always return true. The other expr is valid.
// This currently returns an error?
assert!(matches!(
table
.column_names(
&Predicate::new(vec![
BinaryExpr::from(("host", "!=", "foo")),
BinaryExpr::from(("region", "=", "west")),
]),
&[],
Selection::All,
BTreeSet::new(),
),
Err(Error::ColumnDoesNotExist { column_name }) if column_name == "host",
));
// invalid predicate
assert!(matches!(