@@ -28,13 +28,14 @@ This crate is a submodule of DataFusion that contains an implementation of [sqll
28
28
## Overview
29
29
30
30
This crate uses [ sqllogictest-rs] ( https://github.com/risinglightdb/sqllogictest-rs ) to parse and run ` .slt ` files in the
31
- [ ` test_files ` ] ( test_files ) directory of this crate.
31
+ [ ` test_files ` ] ( test_files ) directory of this crate or the [ ` data/sqlite ` ] ( sqlite )
32
+ directory of the datafusion-testing crate.
32
33
33
34
## Testing setup
34
35
35
36
1 . ` rustup update stable ` DataFusion uses the latest stable release of rust
36
37
2 . ` git submodule init `
37
- 3 . ` git submodule update `
38
+ 3 . ` git submodule update --init --remote --recursive `
38
39
39
40
## Running tests: TLDR Examples
40
41
@@ -160,7 +161,7 @@ cargo test --test sqllogictests -- information
160
161
Test files that start with prefix ` pg_compat_ ` verify compatibility
161
162
with Postgres by running the same script files both with DataFusion and with Postgres
162
163
163
- In order to run the sqllogictests running against a previously running Postgres instance, do:
164
+ In order to have the sqllogictest run against an existing running Postgres instance, do:
164
165
165
166
``` shell
166
167
PG_COMPAT=true PG_URI=
" postgresql://[email protected] /postgres" cargo
test --features=postgres --test sqllogictests
@@ -172,7 +173,7 @@ The environment variables:
172
173
2 . ` PG_URI ` contains a ` libpq ` style connection string, whose format is described in
173
174
[ the docs] ( https://docs.rs/tokio-postgres/latest/tokio_postgres/config/struct.Config.html#url )
174
175
175
- One way to create a suitable a posgres container in docker is to use
176
+ One way to create a suitable a postgres container in docker is to use
176
177
the [ Official Image] ( https://hub.docker.com/_/postgres ) with a command
177
178
such as the following. Note the collation ** must** be set to ` C ` otherwise
178
179
` ORDER BY ` will not match DataFusion and the tests will diff.
@@ -185,6 +186,15 @@ docker run \
185
186
postgres
186
187
```
187
188
189
+ If you do not want to create a new postgres database and you have docker
190
+ installed you can skip providing a PG_URI env variable and the sqllogictest
191
+ runner will automatically create a temporary postgres docker container.
192
+ For example:
193
+
194
+ ``` shell
195
+ PG_COMPAT=true cargo test --features=postgres --test sqllogictests
196
+ ```
197
+
188
198
## Running Tests: ` tpch `
189
199
190
200
Test files in ` tpch ` directory runs against the ` TPCH ` data set (SF =
@@ -205,6 +215,34 @@ Then you need to add `INCLUDE_TPCH=true` to run tpch tests:
205
215
INCLUDE_TPCH=true cargo test --test sqllogictests
206
216
```
207
217
218
+ ## Running Tests: ` sqlite `
219
+
220
+ Test files in ` data/sqlite ` directory of the datafusion-testing crate were
221
+ sourced from the [ sqlite test suite] ( https://www.sqlite.org/sqllogictest/dir?ci=tip ) and have been cleansed and updated to
222
+ run within DataFusion's sqllogictest runner.
223
+
224
+ To run the sqlite tests you need to increase the rust stack size and add
225
+ ` INCLUDE_SQLITE=true ` to run the sqlite tests:
226
+
227
+ ``` shell
228
+ export RUST_MIN_STACK=30485760;
229
+ INCLUDE_SQLITE=true cargo test --test sqllogictests
230
+ ```
231
+
232
+ Note that there are well over 5 million queries in these tests and running the
233
+ sqlite tests will take a long time. You may wish to run them in release-nonlto mode:
234
+
235
+ ``` shell
236
+ INCLUDE_SQLITE=true cargo test --profile release-nonlto --test sqllogictests
237
+ ```
238
+
239
+ The sqlite tests can also be run with the postgres runner to verify compatibility:
240
+
241
+ ``` shell
242
+ export RUST_MIN_STACK=30485760;
243
+ PG_COMPAT=true INCLUDE_SQLITE=true cargo test --features=postgres --test sqllogictests
244
+ ```
245
+
208
246
## Updating tests: Completion Mode
209
247
210
248
In test script completion mode, ` sqllogictests ` reads a prototype script and runs the statements and queries against the
0 commit comments