-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_join_commands.rs
44 lines (41 loc) · 1.09 KB
/
test_join_commands.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use assert_cmd::prelude::*;
use std::process::Command;
/*
❯ sqlite3 tests/resources/sample.db ".schema"
CREATE TABLE apples
(
id integer primary key autoincrement,
name text,
color text
);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE oranges
(
id integer primary key autoincrement,
name text,
description text
);
DataFusion logical plan
Projection: apples.id, apples.name, apples.color, oranges.id, oranges.name, oranges.description
Inner Join: Filter: apples.id = oranges.id
TableScan: apples
TableScan: oranges
*/
#[test]
fn cli_sql_inner_join_two_tables() {
Command::cargo_bin("rsql")
.unwrap()
.args([
"sql",
"tests/resources/sample.db",
"select * from apples join oranges on apples.id=oranges.id;",
])
.assert()
.success()
.stdout(predicates::str::contains(
r#"1|Granny Smith|Light Green|1|Navel|Orange
2|Fuji|Red|2|Blood Orange|Deep Red
3|Honeycrisp|Blush Red|3|Cara Cara|Pinkish Red
4|Golden Delicious|Yellow|4|Seville|Bitter Orange"#,
));
}