Updated UNION tests for bats

Signed-off-by: Zach Musgrave <zach@dolthub.com>
This commit is contained in:
Zach Musgrave
2021-01-11 12:11:26 -08:00
parent f695e20a47
commit 86fde80ee1
+10 -10
View File
@@ -590,24 +590,24 @@ SQL
}
@test "sql select union all" {
run dolt sql -q "SELECT 2+2 FROM dual UNION ALL SELECT 2+2 FROM dual UNION ALL SELECT 2+3 FROM dual;"
run dolt sql -r csv -q "SELECT 2+2 FROM dual UNION ALL SELECT 2+2 FROM dual UNION ALL SELECT 2+3 FROM dual;"
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 7 ]
[ "${#lines[@]}" -eq 4 ]
}
@test "sql select union" {
run dolt sql -q "SELECT 2+2 FROM dual UNION SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual;"
run dolt sql -r csv -q "SELECT 2+2 FROM dual UNION SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual;"
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 7 ]
run dolt sql -q "SELECT 2+2 FROM dual UNION DISTINCT SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual;"
[ "${#lines[@]}" -eq 3 ]
run dolt sql -r csv -q "SELECT 2+2 FROM dual UNION DISTINCT SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual;"
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 6 ]
run dolt sql -q "(SELECT 2+2 FROM dual UNION DISTINCT SELECT 2+2 FROM dual) UNION SELECT 2+3 FROM dual;"
[ "${#lines[@]}" -eq 3 ]
run dolt sql -r csv -q "(SELECT 2+2 FROM dual UNION DISTINCT SELECT 2+2 FROM dual) UNION SELECT 2+3 FROM dual;"
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 6 ]
run dolt sql -q "SELECT 2+2 FROM dual UNION DISTINCT (SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual);"
[ "${#lines[@]}" -eq 3 ]
run dolt sql -r csv -q "SELECT 2+2 FROM dual UNION DISTINCT (SELECT 2+2 FROM dual UNION SELECT 2+3 FROM dual);"
[ $status -eq 0 ]
[ "${#lines[@]}" -eq 6 ]
[ "${#lines[@]}" -eq 3 ]
}
@test "sql greatest/least with a timestamp" {