From a47e7d9b79f8bb1df054fcb432bf7be4c1762054 Mon Sep 17 00:00:00 2001 From: Matthew Van Schellebeeck Date: Sun, 27 Nov 2022 16:21:46 -0500 Subject: [PATCH 01/19] sqllogictests v0 --- tests/sqllogictests/.gitignore | 1 + tests/sqllogictests/Cargo.toml | 12 + tests/sqllogictests/README.md | 45 + tests/sqllogictests/src/main.rs | 95 ++ tests/sqllogictests/src/setup.rs | 184 ++++ tests/sqllogictests/src/utils.rs | 23 + tests/sqllogictests/test_files/aggregate.slt | 868 ++++++++++++++++++ .../sqllogictests/test_files/arrow_typeof.slt | 65 ++ 8 files changed, 1293 insertions(+) create mode 100644 tests/sqllogictests/.gitignore create mode 100644 tests/sqllogictests/Cargo.toml create mode 100644 tests/sqllogictests/README.md create mode 100644 tests/sqllogictests/src/main.rs create mode 100644 tests/sqllogictests/src/setup.rs create mode 100644 tests/sqllogictests/src/utils.rs create mode 100644 tests/sqllogictests/test_files/aggregate.slt create mode 100644 tests/sqllogictests/test_files/arrow_typeof.slt diff --git a/tests/sqllogictests/.gitignore b/tests/sqllogictests/.gitignore new file mode 100644 index 0000000000000..8e5bbf044f1e0 --- /dev/null +++ b/tests/sqllogictests/.gitignore @@ -0,0 +1 @@ +*.py \ No newline at end of file diff --git a/tests/sqllogictests/Cargo.toml b/tests/sqllogictests/Cargo.toml new file mode 100644 index 0000000000000..7bdfb9c503456 --- /dev/null +++ b/tests/sqllogictests/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "datafusion-sqllogictests" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } +datafusion = { path = "../../datafusion/core" } +sqllogictest = { git = "https://github.com/risinglightdb/sqllogictest-rs.git", rev = "282a6008f9b2d0b4e9c498fb637c4c03e92ecf43" } +async-trait = "0.1.58" diff --git a/tests/sqllogictests/README.md b/tests/sqllogictests/README.md new file mode 100644 index 0000000000000..7792ddde87b83 --- /dev/null +++ b/tests/sqllogictests/README.md @@ -0,0 +1,45 @@ +#### Overview + +This is the Datafusion implementation of [sqllogictest](https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki). We use [sqllogictest-rs](https://github.com/risinglightdb/sqllogictest-rs) as a parser/runner of `.slt` files in `test_files`. + +#### Running tests + +`cargo run -p datafusion-sqllogictests` + +#### Setup + + +#### sqllogictests + +> :warning: **Warning**:Datafusion's sqllogictest implementation and migration is still in progress. Definitions taken from https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki + +sqllogictest is a program originally written for SQLite to verify the correctness of SQL queries against the SQLLite engine. The program is engine-agnostic and can parse sqllogictest files (`.slt`), runs queries against an SQL engine and compare the output to the expected output. + +Tests in the `.slt` file are a sequence of query record generally starting with `CREATE` statements to populate tables and then further queries to test the populated data (arrow-datafusion exception). + +Query records follow the format: +```sql +# +query