Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sqlite test files into sqllogictests #13932

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a18c82f
Fix md5 return_type to only return Utf8 as per current code impl.
Omega359 Nov 15, 2024
ad50ae6
Merge remote-tracking branch 'origin/main'
Omega359 Nov 21, 2024
1e87f7e
Merge remote-tracking branch 'origin/main'
Omega359 Nov 28, 2024
cc1f540
Merge remote-tracking branch 'origin/main'
Omega359 Dec 3, 2024
9385fac
Merge remote-tracking branch 'refs/remotes/origin/main' into feature/…
Omega359 Dec 11, 2024
fb53cec
Adding sqlite test slt file suite
Omega359 Dec 11, 2024
94870d9
Merge remote-tracking branch 'refs/remotes/origin/main' into feature/…
Omega359 Dec 13, 2024
26eac83
Updated postgres test container to v17, other small improvements.
Omega359 Dec 13, 2024
c64dc4e
Merge remote-tracking branch 'refs/remotes/upstream/main' into featur…
Omega359 Dec 13, 2024
6a1f60c
regenerated sqlite test files, updated test runner to allow running o…
Omega359 Dec 14, 2024
51a8da4
cargo fmt/toml format fixes.
Omega359 Dec 15, 2024
830f765
Added console feedback for sqllogictests
Omega359 Dec 15, 2024
32621c6
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 15, 2024
f4fb261
Added completed in xx time message
Omega359 Dec 15, 2024
a733c8f
Merge remote-tracking branch 'origin/main'
Omega359 Dec 16, 2024
d4eafc1
Clippy, fmt updates
Omega359 Dec 17, 2024
1c09b91
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 17, 2024
03ce689
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 20, 2024
674df06
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 21, 2024
e9323f6
Fixes and updated dependency
Omega359 Dec 21, 2024
87b388e
Merge remote-tracking branch 'origin/main'
Omega359 Dec 21, 2024
e6d2bbb
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 23, 2024
8e5d0f1
Moving sqlite files to datafusion-testing repository.
Omega359 Dec 24, 2024
a165354
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 26, 2024
6f0a241
Updates to fix a build issue.
Omega359 Dec 26, 2024
af4639d
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 26, 2024
6fc3538
Merge branch 'main' into feature/sqllogictest_add_sqlite
Omega359 Dec 27, 2024
199c75b
Adding datafusion-testing as a submodule
Omega359 Dec 27, 2024
6a3ee18
Merge remote-tracking branch 'origin/main' into feature/sqllogictest_…
Omega359 Dec 28, 2024
ad53691
Postgresql -> postgres
Omega359 Dec 28, 2024
a23594c
Prettier
Omega359 Dec 28, 2024
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
[submodule "testing"]
path = testing
url = https://github.com/apache/arrow-testing
[submodule "datafusion-testing"]
path = datafusion-testing
url = https://github.com/apache/datafusion-testing.git
branch = main
1 change: 1 addition & 0 deletions datafusion-testing
Submodule datafusion-testing added at e2e320
9 changes: 8 additions & 1 deletion datafusion/sqllogictest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ datafusion-common = { workspace = true, default-features = true }
datafusion-common-runtime = { workspace = true, default-features = true }
futures = { workspace = true }
half = { workspace = true, default-features = true }
indicatif = "0.17"
itertools = { workspace = true }
log = { workspace = true }
object_store = { workspace = true }
once_cell = { version = "1.20", optional = true }
postgres-protocol = { version = "0.6.7", optional = true }
postgres-types = { version = "0.2.8", features = ["derive", "with-chrono-0_4"], optional = true }
rust_decimal = { version = "1.36.0", features = ["tokio-pg"] }
sqllogictest = "0.24.0"
sqlparser = { workspace = true }
tempfile = { workspace = true }
testcontainers = { version = "0.23", features = ["default"], optional = true }
testcontainers-modules = { version = "0.11", features = ["postgres"], optional = true }
thiserror = "2.0.0"
tokio = { workspace = true }
tokio-postgres = { version = "0.7.12", optional = true }
Expand All @@ -63,9 +67,12 @@ avro = ["datafusion/avro"]
postgres = [
"bytes",
"chrono",
"tokio-postgres",
"once_cell",
"postgres-types",
"postgres-protocol",
"testcontainers",
"testcontainers-modules",
"tokio-postgres",
]

[dev-dependencies]
Expand Down
44 changes: 41 additions & 3 deletions datafusion/sqllogictest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ This crate is a submodule of DataFusion that contains an implementation of [sqll
## Overview

This crate uses [sqllogictest-rs](https://github.com/risinglightdb/sqllogictest-rs) to parse and run `.slt` files in the
[`test_files`](test_files) directory of this crate.
[`test_files`](test_files) directory of this crate or the [`data/sqlite`](sqlite)
directory of the datafusion-testing crate.

## Testing setup

Expand Down Expand Up @@ -160,7 +161,7 @@ cargo test --test sqllogictests -- information
Test files that start with prefix `pg_compat_` verify compatibility
with Postgres by running the same script files both with DataFusion and with Postgres

In order to run the sqllogictests running against a previously running Postgres instance, do:
In order to have the sqllogictest run against an existing running Postgres instance, do:

```shell
PG_COMPAT=true PG_URI="postgresql://[email protected]/postgres" cargo test --features=postgres --test sqllogictests
Expand All @@ -172,7 +173,7 @@ The environment variables:
2. `PG_URI` contains a `libpq` style connection string, whose format is described in
[the docs](https://docs.rs/tokio-postgres/latest/tokio_postgres/config/struct.Config.html#url)

One way to create a suitable a posgres container in docker is to use
One way to create a suitable a postgres container in docker is to use
the [Official Image](https://hub.docker.com/_/postgres) with a command
such as the following. Note the collation **must** be set to `C` otherwise
`ORDER BY` will not match DataFusion and the tests will diff.
Expand All @@ -185,6 +186,15 @@ docker run \
postgres
```

If you do not want to create a new postgres database and you have docker
installed you can skip providing a PG_URI env variable and the sqllogictest
runner will automatically create a temporary postgres docker container.
For example:

```shell
PG_COMPAT=true cargo test --features=postgres --test sqllogictests
```

## Running Tests: `tpch`

Test files in `tpch` directory runs against the `TPCH` data set (SF =
Expand All @@ -205,6 +215,34 @@ Then you need to add `INCLUDE_TPCH=true` to run tpch tests:
INCLUDE_TPCH=true cargo test --test sqllogictests
```

## Running Tests: `sqlite`

Test files in `data/sqlite` directory of the datafusion-testing crate were
sourced from the sqlite test suite and have been cleansed and updated to
run within DataFusion's sqllogictest runner.

To run the sqlite tests you need to increase the rust stack size and add
`INCLUDE_SQLITE=true` to run the sqlite tests:

```shell
export RUST_MIN_STACK=30485760;
INCLUDE_SQLITE=true cargo test --test sqllogictests
```

Note that there are well over 5 million queries in these tests and running the
sqlite tests will take a long time. You may wish to run them in release-nonlto mode:

```shell
INCLUDE_SQLITE=true cargo test --profile release-nonlto --test sqllogictests
```

The sqlite tests can also be run with the postgres runner to verify compatibility:

```shell
export RUST_MIN_STACK=30485760;
PG_COMPAT=true INCLUDE_SQLITE=true cargo test --features=postgres --test sqllogictests
```

## Updating tests: Completion Mode

In test script completion mode, `sqllogictests` reads a prototype script and runs the statements and queries against the
Expand Down
Loading
Loading