Skip to content

test: integration, compile all dialects and diff#5344

Merged
kgutwin merged 3 commits intoPRQL:mainfrom
bioteam:kg/compile-all-snapshots
Jul 2, 2025
Merged

test: integration, compile all dialects and diff#5344
kgutwin merged 3 commits intoPRQL:mainfrom
bioteam:kg/compile-all-snapshots

Conversation

@kgutwin
Copy link
Copy Markdown
Collaborator

@kgutwin kgutwin commented Jul 1, 2025

Adds a new integration test on the set of integration queries, which generates snapshots covering the unified diff between the result of compiling with the generic dialect versus all other dialects. When there's no difference, there's no extra entry in the snapshot, so some snapshots are essentially empty.

This is from a discussion in #5343.

Example snapshot output:

---
source: prqlc/prqlc/tests/integration/queries.rs
expression: "from invoices\nselect { customer_id, invoice_id, total }\ntake 5\nappend (\n  from invoice_items\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
---
--- generic
+++ glaredb
@@ -23,13 +23,13 @@
     ) AS table_2
   UNION
   ALL
   SELECT
     *
   FROM
     table_0
 )
 SELECT
   customer_id * 2 AS a,
-  ROUND(invoice_id * total, 1) AS b
+  ROUND((invoice_id * total)::numeric, 1) AS b
 FROM
   table_1


--- generic
+++ postgres
@@ -23,13 +23,13 @@
     ) AS table_2
   UNION
   ALL
   SELECT
     *
   FROM
     table_0
 )
 SELECT
   customer_id * 2 AS a,
-  ROUND(invoice_id * total, 1) AS b
+  ROUND((invoice_id * total)::numeric, 1) AS b
 FROM
   table_1

Copy link
Copy Markdown
Member

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's awesome!

should we replace the existing sql outputs with this? then we can unify the two test types in #5343, iiuc?

@kgutwin
Copy link
Copy Markdown
Collaborator Author

kgutwin commented Jul 2, 2025

I'll merge this now. If you feel like merging the compile and compileall tests, go ahead, it should be pretty straightforward. Thanks!

@kgutwin kgutwin merged commit 819e303 into PRQL:main Jul 2, 2025
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants