Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion datafusion/src/datasource/listing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl ListingOptions {
file_extension: String::new(),
format,
table_partition_cols: vec![],
collect_stat: false,
collect_stat: true,
target_partitions: 1,
}
}
Expand Down Expand Up @@ -303,6 +303,23 @@ mod tests {
Ok(())
}

#[tokio::test]
async fn load_table_stats_by_default() -> Result<()> {
let testdata = crate::test_util::parquet_test_data();
let filename = format!("{}/{}", testdata, "alltypes_plain.parquet");
let opt = ListingOptions::new(Arc::new(ParquetFormat::default()));
let schema = opt
.infer_schema(Arc::new(LocalFileSystem {}), &filename)
.await?;
let table =
ListingTable::new(Arc::new(LocalFileSystem {}), filename, schema, opt);
let exec = table.scan(&None, 1024, &[], None).await?;
assert_eq!(exec.statistics().num_rows, Some(8));
assert_eq!(exec.statistics().total_byte_size, Some(671));

Ok(())
}

#[tokio::test]
async fn read_empty_table() -> Result<()> {
let store = TestObjectStore::new_arc(&[("table/p1=v1/file.avro", 100)]);
Expand Down