Skip to content

Commit 7ee2c0b

Browse files
alambjonahgaojackwener
authored
Minor: Upate the sqllogictest crate README (#7971)
* Minor: Upate the sqllogictest crate README * prettier * Apply suggestions from code review Co-authored-by: Jonah Gao <jonahgaox@gmail.com> Co-authored-by: jakevin <jakevingoo@gmail.com> --------- Co-authored-by: Jonah Gao <jonahgaox@gmail.com> Co-authored-by: jakevin <jakevingoo@gmail.com>
1 parent 3fd8a20 commit 7ee2c0b

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

datafusion/sqllogictest/README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@
1717
under the License.
1818
-->
1919

20-
#### Overview
20+
# DataFusion sqllogictest
2121

22-
This is the Datafusion implementation of [sqllogictest](https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki). We
23-
use [sqllogictest-rs](https://github.com/risinglightdb/sqllogictest-rs) as a parser/runner of `.slt` files
24-
in [`test_files`](test_files).
22+
[DataFusion][df] is an extensible query execution framework, written in Rust, that uses Apache Arrow as its in-memory format.
2523

26-
#### Testing setup
24+
This crate is a submodule of DataFusion that contains an implementation of [sqllogictest](https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki).
25+
26+
[df]: https://crates.io/crates/datafusion
27+
28+
## Overview
29+
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.
32+
33+
## Testing setup
2734

2835
1. `rustup update stable` DataFusion uses the latest stable release of rust
2936
2. `git submodule init`
3037
3. `git submodule update`
3138

32-
#### Running tests: TLDR Examples
39+
## Running tests: TLDR Examples
3340

3441
```shell
3542
# Run all tests
@@ -56,7 +63,7 @@ cargo test --test sqllogictests -- ddl --complete
5663
RUST_LOG=debug cargo test --test sqllogictests -- ddl
5764
```
5865

59-
#### Cookbook: Adding Tests
66+
## Cookbook: Adding Tests
6067

6168
1. Add queries
6269

@@ -95,11 +102,11 @@ SELECT * from foo;
95102

96103
Assuming it looks good, check it in!
97104

98-
#### Reference
105+
# Reference
99106

100-
#### Running tests: Validation Mode
107+
## Running tests: Validation Mode
101108

102-
In this model, `sqllogictests` runs the statements and queries in a `.slt` file, comparing the expected output in the
109+
In this mode, `sqllogictests` runs the statements and queries in a `.slt` file, comparing the expected output in the
103110
file to the output produced by that run.
104111

105112
For example, to run all tests suites in validation mode
@@ -115,10 +122,10 @@ sqllogictests also supports `cargo test` style substring matches on file names t
115122
cargo test --test sqllogictests -- information
116123
```
117124

118-
#### Running tests: Postgres compatibility
125+
## Running tests: Postgres compatibility
119126

120127
Test files that start with prefix `pg_compat_` verify compatibility
121-
with Postgres by running the same script files both with DataFusion and with Posgres
128+
with Postgres by running the same script files both with DataFusion and with Postgres
122129

123130
In order to run the sqllogictests running against a previously running Postgres instance, do:
124131

@@ -145,7 +152,7 @@ docker run \
145152
postgres
146153
```
147154

148-
#### Running Tests: `tpch`
155+
## Running Tests: `tpch`
149156

150157
Test files in `tpch` directory runs against the `TPCH` data set (SF =
151158
0.1), which must be generated before running. You can use following
@@ -165,7 +172,7 @@ Then you need to add `INCLUDE_TPCH=true` to run tpch tests:
165172
INCLUDE_TPCH=true cargo test --test sqllogictests
166173
```
167174

168-
#### Updating tests: Completion Mode
175+
## Updating tests: Completion Mode
169176

170177
In test script completion mode, `sqllogictests` reads a prototype script and runs the statements and queries against the
171178
database engine. The output is a full script that is a copy of the prototype script with result inserted.
@@ -177,7 +184,7 @@ You can update the tests / generate expected output by passing the `--complete`
177184
cargo test --test sqllogictests -- ddl --complete
178185
```
179186

180-
#### Running tests: `scratchdir`
187+
## Running tests: `scratchdir`
181188

182189
The DataFusion sqllogictest runner automatically creates a directory
183190
named `test_files/scratch/<filename>`, creating it if needed and
@@ -190,7 +197,7 @@ Tests that need to write temporary files should write (only) to this
190197
directory to ensure they do not interfere with others concurrently
191198
running tests.
192199

193-
#### `.slt` file format
200+
## `.slt` file format
194201

195202
[`sqllogictest`] was originally written for SQLite to verify the
196203
correctness of SQL queries against the SQLite engine. The format is designed
@@ -247,7 +254,7 @@ query <type_string> <sort_mode>
247254
> :warning: It is encouraged to either apply `order by`, or use `rowsort` for queries without explicit `order by`
248255
> clauses.
249256
250-
##### Example
257+
### Example
251258

252259
```sql
253260
# group_by_distinct

0 commit comments

Comments
 (0)