Skip to content

Commit

Permalink
[test] check output schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Oct 28, 2021
1 parent f207b92 commit dfa6d0e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions datafusion/src/datasource/listing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ mod tests {
object_store::local::LocalFileSystem,
},
logical_plan::{col, lit},
test::object_store::TestObjectStore,
test::{columns, object_store::TestObjectStore},
};

use super::*;
Expand Down Expand Up @@ -314,9 +314,14 @@ mod tests {
collect_stat: true,
};

let schema = Schema::new(vec![Field::new("a", DataType::Boolean, false)]);
let file_schema = Schema::new(vec![Field::new("a", DataType::Boolean, false)]);

let table = ListingTable::new(store, "table/".to_owned(), Arc::new(schema), opt);
let table =
ListingTable::new(store, "table/".to_owned(), Arc::new(file_schema), opt);
assert_eq!(
columns(&table.schema()),
vec!["a".to_owned(), "p1".to_owned()]
);

// this will filter out the only file in the store
let filter = Expr::not_eq(col("p1"), lit("v1"));
Expand All @@ -327,6 +332,10 @@ mod tests {
.expect("Empty execution plan");

assert!(scan.as_any().is::<EmptyExec>());
assert_eq!(
columns(&scan.schema()),
vec!["a".to_owned(), "p1".to_owned()]
);

Ok(())
}
Expand Down

0 comments on commit dfa6d0e

Please sign in to comment.