Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/workflows/build-devcontainer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
timeout-minutes: 240
steps:
- uses: actions/checkout@v5
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,6 @@ jobs:
push-devcontainer:
if: github.event_name == 'release'
uses: ./.github/workflows/build-devcontainer.yaml
secrets: inherit
with:
push: true
6 changes: 6 additions & 0 deletions .github/workflows/test-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
uses: actions/checkout@v5
with:
fetch-tags: true
- name: Log in to Docker Hub
if: ${{ contains(inputs.features, 'test-dbs-external') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run docker compose
# This can go early because the DBs take a few seconds to start up.
if: ${{ contains(inputs.features, 'test-dbs-external') }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ jobs:
needs: rules
if: needs.rules.outputs.rust == 'true' || needs.rules.outputs.main == 'true'
uses: ./.github/workflows/test-rust.yaml
secrets: inherit
strategy:
matrix:
include:
Expand Down Expand Up @@ -326,6 +327,7 @@ jobs:
# target: aarch64-unknown-linux-musl

uses: ./.github/workflows/test-rust.yaml
secrets: inherit
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
Expand Down Expand Up @@ -534,6 +536,7 @@ jobs:
needs: rules
if: needs.rules.outputs.devcontainer-build == 'true'
uses: ./.github/workflows/build-devcontainer.yaml
secrets: inherit
# One problem with this setup is that if another commit is merged to main,
# this workflow will cancel existing jobs, and so this won't get pushed. We
# have another workflow which runs on each release, so the image should get
Expand Down
16 changes: 8 additions & 8 deletions prqlc/prqlc/tests/integration/bad_error_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn test_bad_error_messages() {
assert_snapshot!(compile(r###"
from film
group
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :3:5 ]
Expand All @@ -44,7 +44,7 @@ fn test_bad_error_messages() {

from employees
filter f location
"#).unwrap_err(), @r"
"#).unwrap_err(), @"
Error:
╭─[ :5:14 ]
Expand All @@ -58,7 +58,7 @@ fn test_bad_error_messages() {
assert_snapshot!(compile(r###"
select tracks
from artists
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :3:5 ]
Expand Down Expand Up @@ -136,7 +136,7 @@ fn misplaced_type_error() {
let foo = 123
from t
select (true && foo)
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:15 ]
Expand All @@ -152,7 +152,7 @@ fn test_hint_missing_args() {
assert_snapshot!(compile(r###"
from film
select {film_id, lag film_id}
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :3:22 ]
Expand All @@ -169,7 +169,7 @@ fn test_hint_missing_args() {
fn test_relation_literal_contains_literals() {
assert_snapshot!(compile(r###"
[{a=(1+1)}]
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:9 ]
Expand All @@ -196,7 +196,7 @@ fn nested_groups() {
}
)
)
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :9:9 ]
Expand All @@ -213,7 +213,7 @@ fn nested_groups() {
fn just_std() {
assert_snapshot!(compile(r###"
std
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :1:1 ]
Expand Down
60 changes: 28 additions & 32 deletions prqlc/prqlc/tests/integration/error_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn test_errors() {
from x
derive y = (addadd 4 5 6)
"###).unwrap_err(),
@r"
@"
Error:
╭─[ :5:17 ]
Expand All @@ -27,7 +27,7 @@ fn test_errors() {
assert_snapshot!(compile(r###"
from a select b
"###).unwrap_err(),
@r"
@"
Error:
╭─[ :2:5 ]
Expand All @@ -42,7 +42,7 @@ fn test_errors() {
select a
select b
"###).unwrap_err(),
@r"
@"
Error:
╭─[ :4:12 ]
Expand All @@ -58,7 +58,7 @@ fn test_errors() {
from employees
take 1.8
"###).unwrap_err(),
@r"
@"
Error:
╭─[ :3:10 ]
Expand Down Expand Up @@ -88,7 +88,7 @@ fn test_errors() {
"#);

// PARSER output (full compilation error):
assert_snapshot!(compile(mississippi).unwrap_err(), @r"
assert_snapshot!(compile(mississippi).unwrap_err(), @"
Error:
╭─[ :1:23 ]
Expand All @@ -98,7 +98,7 @@ fn test_errors() {
───╯
");

assert_snapshot!(compile("Answer: T-H-A-T!").unwrap_err(), @r"
assert_snapshot!(compile("Answer: T-H-A-T!").unwrap_err(), @"
Error:
╭─[ :1:16 ]
Expand All @@ -117,7 +117,7 @@ fn test_union_all_sqlite() {

from film
remove film2
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error: The dialect SQLiteDialect does not support EXCEPT ALL
↳ Hint: providing more column information will allow the query to be translated to an anti-join.
")
Expand All @@ -129,7 +129,7 @@ fn test_regex_dialect() {
prql target:sql.mssql
from foo
filter bar ~= 'love'
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :4:12 ]
Expand All @@ -147,7 +147,7 @@ fn test_bad_function_type() {
group foo (take)
"###,
)
.unwrap_err(), @r"
.unwrap_err(), @"
Error:
╭─[ :3:16 ]
Expand Down Expand Up @@ -187,7 +187,7 @@ fn test_ambiguous() {
derive date = x
select date
"#)
.unwrap_err(), @r"
.unwrap_err(), @"
Error:
╭─[ :4:12 ]
Expand All @@ -210,7 +210,7 @@ fn test_ambiguous_join() {
join (from b | select {x}) true
select x
"#)
.unwrap_err(), @r"
.unwrap_err(), @"
Error:
╭─[ :5:12 ]
Expand All @@ -232,7 +232,7 @@ fn test_ambiguous_inference() {
join b(==b_id)
select x
"#)
.unwrap_err(), @r"
.unwrap_err(), @"
Error:
╭─[ :4:12 ]
Expand Down Expand Up @@ -268,7 +268,7 @@ fn date_to_text_with_column_format() {
from dates_to_display
select {my_date, my_format}
select {std.date.to_text my_date my_format}
"#).unwrap_err(), @r"
"#).unwrap_err(), @"
Error:
╭─[ :4:11 ]
Expand All @@ -285,7 +285,7 @@ fn date_trunc_with_column_unit() {
from dates_to_display
select {my_date, my_unit}
select {std.date.trunc my_unit my_date}
"#).unwrap_err(), @r"
"#).unwrap_err(), @"
Error:
╭─[ :4:11 ]
Expand Down Expand Up @@ -321,7 +321,7 @@ fn available_columns() {
from invoices
select foo
select bar
"#).unwrap_err(), @r"
"#).unwrap_err(), @"
Error:
╭─[ :4:12 ]
Expand Down Expand Up @@ -350,20 +350,16 @@ fn empty_interpolations() {
#[test]
fn no_query_entered() {
// Empty query
assert_snapshot!(compile("").unwrap_err(), @r"
[E0001] Error: No PRQL query entered
");
assert_snapshot!(compile("").unwrap_err(), @"[E0001] Error: No PRQL query entered");

// Comment-only query
assert_snapshot!(compile("# just a comment").unwrap_err(), @r"
[E0001] Error: No PRQL query entered
");
assert_snapshot!(compile("# just a comment").unwrap_err(), @"[E0001] Error: No PRQL query entered");
}

#[test]
fn query_must_begin_with_from() {
// Query with declaration but no 'from'
assert_snapshot!(compile("let x = 5").unwrap_err(), @r"
assert_snapshot!(compile("let x = 5").unwrap_err(), @"
[E0001] Error: PRQL queries must begin with 'from'
↳ Hint: A query must start with a 'from' statement to define the main pipeline
");
Expand All @@ -372,7 +368,7 @@ fn query_must_begin_with_from() {
assert_snapshot!(compile(r#"
let x = 5
let y = 10
"#).unwrap_err(), @r"
"#).unwrap_err(), @"
[E0001] Error: PRQL queries must begin with 'from'
↳ Hint: A query must start with a 'from' statement to define the main pipeline
");
Expand All @@ -384,15 +380,15 @@ fn negative_number_in_transform() {
assert_snapshot!(compile(r###"
from artists
sort -name
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error: expected a pipeline that resolves to a table, but found `internal std.sub`
↳ Hint: wrap negative numbers in parentheses, e.g. `sort (-column_name)`
");

assert_snapshot!(compile(r###"
from pets
take -10
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error: expected a pipeline that resolves to a table, but found `internal std.sub`
↳ Hint: wrap negative numbers in parentheses, e.g. `sort (-column_name)`
");
Expand All @@ -402,7 +398,7 @@ fn negative_number_in_transform() {
group id (
sort -val
)
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error: expected a pipeline that resolves to a table, but found `internal std.sub`
↳ Hint: wrap negative numbers in parentheses, e.g. `sort (-column_name)`
");
Expand All @@ -412,7 +408,7 @@ fn negative_number_in_transform() {
fn empty_tuple_or_array_from() {
assert_snapshot!(compile(r###"
from {}
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:10 ]
Expand All @@ -424,7 +420,7 @@ fn empty_tuple_or_array_from() {

assert_snapshot!(compile(r###"
from []
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:10 ]
Expand All @@ -437,7 +433,7 @@ fn empty_tuple_or_array_from() {
assert_snapshot!(compile(r###"
from {}
select a
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:10 ]
Expand All @@ -454,7 +450,7 @@ fn window_rows_expects_range() {
assert_snapshot!(compile(r###"
from t
group sid (window rows:2 (sid))
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :3:28 ]
Expand All @@ -467,7 +463,7 @@ fn window_rows_expects_range() {
assert_snapshot!(compile(r###"
from t
group sid (window range:2 (sid))
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :3:29 ]
Expand All @@ -484,7 +480,7 @@ fn bare_lambda_expression() {
// a clear error, not a confusing internal message.
assert_snapshot!(compile(r###"
x -> y
"###).unwrap_err(), @r"
"###).unwrap_err(), @"
Error:
╭─[ :2:5 ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
source: prqlc/prqlc/tests/integration/queries.rs
expression: "from invoices\nselect { customer_id, invoice_id, billing_country }\ntake 10..15\nappend (\n from invoices\n select { customer_id, invoice_id, billing_country }\n take 40..45\n)\nselect { billing_country, invoice_id }\n"
input_file: prqlc/prqlc/tests/integration/queries/append_select.prql
snapshot_kind: text
---
SELECT
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
source: prqlc/prqlc/tests/integration/queries.rs
expression: "from invoices\nderive total = case [total < 10 => total * 2, true => total]\nselect { customer_id, invoice_id, total }\ntake 5\nappend (\n from invoice_items\n derive unit_price = case [unit_price < 1 => unit_price * 2, true => unit_price]\n select { invoice_line_id, invoice_id, unit_price }\n take 5\n)\nselect { a = customer_id * 2, b = math.round 1 (invoice_id * total) }\n"
input_file: prqlc/prqlc/tests/integration/queries/append_select_compute.prql
snapshot_kind: text
---
WITH table_1 AS (
SELECT
Expand Down
Loading
Loading