Skip to content

Commit

Permalink
test: add test for date type partitioning #1445
Browse files Browse the repository at this point in the history
  • Loading branch information
cmackenzie1 committed Jun 7, 2023
1 parent b644d8a commit c7d023b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"protocol":{"minReaderVersion":1,"minWriterVersion":1}}
{"metaData":{"id":"93bea48b-6453-474c-9214-4fd69194db55","name":null,"description":null,"format":{"provider":"parquet","options":{}},"schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}},{\"name\":\"date\",\"type\":\"date\",\"nullable\":false,\"metadata\":{}}]}","partitionColumns":["date"],"createdTime":1686160061066,"configuration":{}}}
{"commitInfo":{"timestamp":1686160061068,"operation":"CREATE TABLE","operationParameters":{"mode":"ErrorIfExists","protocol":"{\"minReaderVersion\":1,\"minWriterVersion\":1}","metadata":"{\"configuration\":{},\"created_time\":1686160061066,\"description\":null,\"format\":{\"options\":{},\"provider\":\"parquet\"},\"id\":\"93bea48b-6453-474c-9214-4fd69194db55\",\"name\":null,\"partition_columns\":[\"date\"],\"schema\":{\"fields\":[{\"metadata\":{},\"name\":\"id\",\"nullable\":true,\"type\":\"integer\"},{\"metadata\":{},\"name\":\"date\",\"nullable\":false,\"type\":\"date\"}],\"type\":\"struct\"}}","location":"file:///Users/cole/github.com/cmackenzie1/delta-rs/rust/tests/data/issue_1445"},"clientVersion":"delta-rs.0.13.0"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"add":{"path":"date=2023-06-07/part-00000-94397190-941b-4859-ad95-4f40dae21a9b-c000.snappy.parquet","size":484,"partitionValues":{"date":"2023-06-07"},"modificationTime":1686160061092,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"id\":1},\"maxValues\":{\"id\":1},\"nullCount\":{\"id\":0}}","tags":null}}
{"add":{"path":"date=2023-06-08/part-00000-938c1d51-6fe7-4b01-84da-ee1aa265befd-c000.snappy.parquet","size":484,"partitionValues":{"date":"2023-06-08"},"modificationTime":1686160061095,"dataChange":true,"stats":"{\"numRecords\":1,\"minValues\":{\"id\":2},\"maxValues\":{\"id\":2},\"nullCount\":{\"id\":0}}","tags":null}}
{"commitInfo":{"timestamp":1686160061095,"clientVersion":"delta-rs.0.13.0"}}
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions rust/tests/datafusion_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,3 +910,35 @@ async fn test_issue_1374() -> Result<()> {

Ok(())
}

#[tokio::test]
async fn test_issue_1445_date_partition() -> Result<()> {
let ctx = SessionContext::new();
let table = deltalake::open_table("./tests/data/issue_1445")
.await
.unwrap();
ctx.register_table("t", Arc::new(table))?;

let batches = ctx
.sql(
r#"SELECT *
FROM t
WHERE date > '2023-06-07'
"#,
)
.await?
.collect()
.await?;

let expected = vec![
"+----+------------+",
"| id | date |",
"+----+------------+",
"| 2 | 2023-06-08 |",
"+----+------------+",
];

assert_batches_sorted_eq!(&expected, &batches);

Ok(())
}

0 comments on commit c7d023b

Please sign in to comment.