Skip to content

Commit

Permalink
Use the correct schema for schema adapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
HawaiianSpork committed Jun 28, 2024
1 parent 7dfadb0 commit d48425e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 1 addition & 5 deletions crates/core/src/delta_datafusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,7 @@ impl<'a> DeltaScanBuilder<'a> {
let config = self.config;
let schema = match self.schema {
Some(schema) => schema,
None => {
self.snapshot
.physical_arrow_schema(self.log_store.object_store())
.await?
}
None => self.snapshot.arrow_schema()?,
};
let logical_schema = df_logical_schema(self.snapshot, &config)?;

Expand Down
15 changes: 8 additions & 7 deletions crates/core/tests/integration_datafusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,13 +900,14 @@ mod local {

let batches = ctx.sql("SELECT * FROM demo").await?.collect().await?;

// Without defining a schema of the select the default for a timestamp is ms UTC
let expected = vec![
"+-------------------------------+---------------------+------------+",
"| BIG_DATE | NORMAL_DATE | SOME_VALUE |",
"+-------------------------------+---------------------+------------+",
"| 1816-03-28T05:56:08.066277376 | 2022-02-01T00:00:00 | 2 |",
"| 1816-03-29T05:56:08.066277376 | 2022-01-01T00:00:00 | 1 |",
"+-------------------------------+---------------------+------------+",
"+-----------------------------+----------------------+------------+",
"| BIG_DATE | NORMAL_DATE | SOME_VALUE |",
"+-----------------------------+----------------------+------------+",
"| 1816-03-28T05:56:08.066278Z | 2022-02-01T00:00:00Z | 2 |",
"| 1816-03-29T05:56:08.066278Z | 2022-01-01T00:00:00Z | 1 |",
"+-----------------------------+----------------------+------------+",
];

assert_batches_sorted_eq!(&expected, &batches);
Expand Down Expand Up @@ -1113,7 +1114,7 @@ mod local {
.unwrap();
let batch = batches.pop().unwrap();

let expected_schema = Schema::new(vec![Field::new("id", ArrowDataType::Int32, true)]);
let expected_schema = Schema::new(vec![Field::new("id", ArrowDataType::Int64, false)]);
assert_eq!(batch.schema().as_ref(), &expected_schema);
Ok(())
}
Expand Down

0 comments on commit d48425e

Please sign in to comment.