From a1f3f413ed958b3aaa066df602d0670c1cf2a7bf Mon Sep 17 00:00:00 2001 From: Chris Truter Date: Fri, 11 Oct 2024 15:17:31 +0200 Subject: [PATCH] Merge most queries into a shared SQL file (#103) I'm finding creating and jumping between tiny files to be quite a chore. This leaves all the EDN for now. We probably want an option to put that inline in the SQL file, but for larger files I want a rich editor experience, without needing a [fancy Emacs mode](https://github.com/polymode/polymode). --- test/macaw/acceptance_test.clj | 48 ++- .../resources/acceptance/between__working.sql | 3 - .../acceptance/bigquery__table_wildcard.sql | 7 - test/resources/acceptance/broken__between.sql | 7 - .../acceptance/broken__filter_where.sql | 7 - .../compound__correlated_subquery.sql | 6 - test/resources/acceptance/compound__cte.sql | 23 -- .../acceptance/compound__cte_deadscope.sql | 4 - .../acceptance/compound__cte_masking.sql | 4 - .../acceptance/compound__cte_nonambiguous.sql | 4 - .../acceptance/compound__cte_pun.sql | 15 - .../acceptance/compound__cte_recursive.sql | 10 - .../acceptance/compound__cte_simple.sql | 1 - .../acceptance/compound__subselect.sql | 13 - .../compound__subselect_table_masking.sql | 10 - test/resources/acceptance/compound__union.sql | 18 -- test/resources/acceptance/cycle__cte.sql | 20 -- .../resources/acceptance/duplicate_scopes.sql | 9 - test/resources/acceptance/generate_series.sql | 2 - .../acceptance/literal__with_table.sql | 1 - .../acceptance/literal__without_table.sql | 1 - .../acceptance/no_source_columns.sql | 2 - .../resources/acceptance/oracle__open_for.sql | 5 - test/resources/acceptance/queries.sql | 296 ++++++++++++++++++ test/resources/acceptance/reserved__final.sql | 9 - .../acceptance/shadow__subselect.sql | 13 - .../acceptance/simple__select_into.sql | 3 - .../acceptance/simple__select_star.sql | 1 - test/resources/acceptance/snowflakelet.sql | 36 --- .../acceptance/sqlserver__execute.sql | 1 - .../acceptance/sqlserver__executesql.sql | 1 - test/resources/acceptance/string_concat.sql | 1 - 32 files changed, 338 insertions(+), 243 deletions(-) delete mode 100644 test/resources/acceptance/between__working.sql delete mode 100644 test/resources/acceptance/bigquery__table_wildcard.sql delete mode 100644 test/resources/acceptance/broken__between.sql delete mode 100644 test/resources/acceptance/broken__filter_where.sql delete mode 100644 test/resources/acceptance/compound__correlated_subquery.sql delete mode 100644 test/resources/acceptance/compound__cte.sql delete mode 100644 test/resources/acceptance/compound__cte_deadscope.sql delete mode 100644 test/resources/acceptance/compound__cte_masking.sql delete mode 100644 test/resources/acceptance/compound__cte_nonambiguous.sql delete mode 100644 test/resources/acceptance/compound__cte_pun.sql delete mode 100644 test/resources/acceptance/compound__cte_recursive.sql delete mode 100644 test/resources/acceptance/compound__cte_simple.sql delete mode 100644 test/resources/acceptance/compound__subselect.sql delete mode 100644 test/resources/acceptance/compound__subselect_table_masking.sql delete mode 100644 test/resources/acceptance/compound__union.sql delete mode 100644 test/resources/acceptance/cycle__cte.sql delete mode 100644 test/resources/acceptance/duplicate_scopes.sql delete mode 100644 test/resources/acceptance/generate_series.sql delete mode 100644 test/resources/acceptance/literal__with_table.sql delete mode 100644 test/resources/acceptance/literal__without_table.sql delete mode 100644 test/resources/acceptance/no_source_columns.sql delete mode 100644 test/resources/acceptance/oracle__open_for.sql create mode 100644 test/resources/acceptance/queries.sql delete mode 100644 test/resources/acceptance/reserved__final.sql delete mode 100644 test/resources/acceptance/shadow__subselect.sql delete mode 100644 test/resources/acceptance/simple__select_into.sql delete mode 100644 test/resources/acceptance/simple__select_star.sql delete mode 100644 test/resources/acceptance/snowflakelet.sql delete mode 100644 test/resources/acceptance/sqlserver__execute.sql delete mode 100644 test/resources/acceptance/sqlserver__executesql.sql delete mode 100644 test/resources/acceptance/string_concat.sql diff --git a/test/macaw/acceptance_test.clj b/test/macaw/acceptance_test.clj index 8497aa9..9b67714 100644 --- a/test/macaw/acceptance_test.clj +++ b/test/macaw/acceptance_test.clj @@ -1,6 +1,7 @@ (ns macaw.acceptance-test (:require [clojure.java.io :as io] + [clojure.set :as set] [clojure.string :as str] [clojure.test :refer :all] [macaw.core :as m] @@ -26,7 +27,7 @@ (some-> fixture (ct/fixture->filename "acceptance" ".renames.edn") io/resource slurp read-string)) (defn- fixture-rewritten [fixture] - (some-> fixture (ct/fixture->filename "acceptance" ".rewritten.sql") io/resource slurp)) + (some-> fixture (ct/fixture->filename "acceptance" ".rewritten.sql") io/resource slurp str/trim)) (defn- get-component [cs k] (case k @@ -41,6 +42,18 @@ (def global-overrides {:basic-select :macaw.error/not-implemented}) +(def ^:private merged-fixtures-file "test/resources/acceptance/queries.sql") + +(defn- merged-fixtures + "The fixtures in merged fixtures file, mapped by their identifiers." + [] + (->> (str/split (slurp merged-fixtures-file) #"-- FIXTURE: ") + (keep (fn [named-query] + (when-not (str/blank? named-query) + (let [[nm qry] (.split ^String named-query "\n" 2)] + [(keyword nm) (str/trim qry)])))) + (into {}))) + (defn- validate-analysis [correct override actual] (let [expected (or override correct)] (when override @@ -71,7 +84,8 @@ "Test that we can parse a given fixture, and compare against expected analysis and rewrites, where they are defined." [fixture] (let [prefix (str "(fixture: " (subs (str fixture) 1) ")") - sql (ct/query-fixture fixture) + merged (merged-fixtures) + sql (or (ct/query-fixture fixture) (get merged fixture)) expected-cs (fixture-analysis fixture) renames (fixture-renames fixture) expected-rw (fixture-rewritten fixture) @@ -104,15 +118,15 @@ (when renames (let [broken? (:broken? renames) rewritten (testing (str prefix " rewriting does not throw") - (is (m/replace-names sql (dissoc renames :broken?) base-opts)))] + (is (str/trim (m/replace-names sql (dissoc renames :broken?) base-opts))))] (when expected-rw (testing (str prefix " rewritten SQL is correct") (if broken? (is (not= expected-rw rewritten)) (is (= expected-rw rewritten))))))))) -(defn find-fixtures - "Find all the fixture symbols within our test resources." +(defn isolated-fixtures + "Find all the fixture symbols for stand-alone sql files within our test resources." [] (->> (io/resource "acceptance") io/file @@ -122,13 +136,21 @@ (when (.endsWith n ".sql") (str/replace n #"\.sql$" ""))))) (remove #(.contains ^String % ".")) + (remove #{"queries"}) (map ct/stem->fixture) (sort-by str))) +(defn- all-fixtures [] + (let [isolated (isolated-fixtures) + merged (keys (merged-fixtures))] + (assert (empty? (set/intersection (set isolated) (set merged))) + "No fixtures should be in both the isolated and merged files") + (sort-by str (distinct (concat isolated merged))))) + (defmacro create-fixture-tests! "Find all the fixture files and for each of them run all the tests we can construct from the related files." [] - (let [fixtures (find-fixtures)] + (let [fixtures (all-fixtures)] (cons 'do (for [f fixtures :let [test-name (symbol (str/replace (ct/fixture->filename f "-test") #"(? 9000) AS high_earners -FROM employees e; diff --git a/test/resources/acceptance/compound__cte.sql b/test/resources/acceptance/compound__cte.sql deleted file mode 100644 index acdb838..0000000 --- a/test/resources/acceptance/compound__cte.sql +++ /dev/null @@ -1,23 +0,0 @@ -WITH department_stats AS ( - SELECT - department, - AVG(salary) AS average_salary, - COUNT(*) AS total_employees - FROM employees - GROUP BY department -), -high_earners AS ( - SELECT - department, - COUNT(*) AS high_earners_count - FROM employees - WHERE salary > 9000 - GROUP BY department -) -SELECT - ds.department as department_name, - ds.average_salary as avg_summary, - ds.total_employees, - COALESCE(he.high_earners_count, 0) AS high_earners -FROM department_stats ds -LEFT JOIN high_earners he ON ds.department = he.department; diff --git a/test/resources/acceptance/compound__cte_deadscope.sql b/test/resources/acceptance/compound__cte_deadscope.sql deleted file mode 100644 index ac00530..0000000 --- a/test/resources/acceptance/compound__cte_deadscope.sql +++ /dev/null @@ -1,4 +0,0 @@ -WITH cte AS ( - SELECT x FROM t1 -) -SELECT x, y FROM t2 diff --git a/test/resources/acceptance/compound__cte_masking.sql b/test/resources/acceptance/compound__cte_masking.sql deleted file mode 100644 index d0cdd7d..0000000 --- a/test/resources/acceptance/compound__cte_masking.sql +++ /dev/null @@ -1,4 +0,0 @@ -WITH c AS (SELECT x FROM b), - b AS (SELECT y FROM a), - a AS (SELECT x FROM c) -SELECT a.x, b.y FROM a, b diff --git a/test/resources/acceptance/compound__cte_nonambiguous.sql b/test/resources/acceptance/compound__cte_nonambiguous.sql deleted file mode 100644 index a957088..0000000 --- a/test/resources/acceptance/compound__cte_nonambiguous.sql +++ /dev/null @@ -1,4 +0,0 @@ -WITH cte AS ( - SELECT x FROM t1 -) -SELECT x, y FROM t2 JOIN cte diff --git a/test/resources/acceptance/compound__cte_pun.sql b/test/resources/acceptance/compound__cte_pun.sql deleted file mode 100644 index 552bbc6..0000000 --- a/test/resources/acceptance/compound__cte_pun.sql +++ /dev/null @@ -1,15 +0,0 @@ -with q as ( - select - id - from - report_card - where - created_at > '2024-01-01' - limit - 1 -) -select - created_at -from - report_dashboardcard dc - join q on dc.card_id = q.id; diff --git a/test/resources/acceptance/compound__cte_recursive.sql b/test/resources/acceptance/compound__cte_recursive.sql deleted file mode 100644 index 21dd88f..0000000 --- a/test/resources/acceptance/compound__cte_recursive.sql +++ /dev/null @@ -1,10 +0,0 @@ -WITH RECURSIVE hierarchy AS ( - SELECT id, manager_id, name - FROM employees - WHERE manager_id IS NULL - UNION ALL - SELECT e.id, e.manager_id, e.name - FROM employees e - JOIN hierarchy eh ON e.manager_id = eh.id -) -SELECT * FROM hierarchy; diff --git a/test/resources/acceptance/compound__cte_simple.sql b/test/resources/acceptance/compound__cte_simple.sql deleted file mode 100644 index 195dc71..0000000 --- a/test/resources/acceptance/compound__cte_simple.sql +++ /dev/null @@ -1 +0,0 @@ -WITH cte AS (SELECT x FROM t1) SELECT cte.x, y FROM t2 JOIN cte; diff --git a/test/resources/acceptance/compound__subselect.sql b/test/resources/acceptance/compound__subselect.sql deleted file mode 100644 index 19e8426..0000000 --- a/test/resources/acceptance/compound__subselect.sql +++ /dev/null @@ -1,13 +0,0 @@ -SELECT - e.department as department_name, - e.average_salary as avg_salary, - e.total_employees, - (SELECT COUNT(*) FROM employees WHERE department = e.department AND salary > 9000) AS high_earners -FROM ( - SELECT - department, - AVG(salary) AS average_salary, - COUNT(*) AS total_employees - FROM employees - GROUP BY department -) e; diff --git a/test/resources/acceptance/compound__subselect_table_masking.sql b/test/resources/acceptance/compound__subselect_table_masking.sql deleted file mode 100644 index 5920fea..0000000 --- a/test/resources/acceptance/compound__subselect_table_masking.sql +++ /dev/null @@ -1,10 +0,0 @@ -SELECT -CASE WHEN Addr.country = 'US' THEN Addr.state ELSE 'ex-US' END AS state -FROM ( - SELECT DISTINCT - coalesce(Cust.state, Addr.region) AS state, - coalesce(Cust.country, Addr.country) AS country - FROM orders - LEFT JOIN addresses AS Addr ON orders.organization_id = Addr.organization_id - LEFT JOIN customers AS Cust ON orders.customer_id = Cust.id -) AS Addr diff --git a/test/resources/acceptance/compound__union.sql b/test/resources/acceptance/compound__union.sql deleted file mode 100644 index acffd78..0000000 --- a/test/resources/acceptance/compound__union.sql +++ /dev/null @@ -1,18 +0,0 @@ -SELECT - department as department_name, - AVG(salary) AS avg_salary, - COUNT(*) AS total_employees, - NULL AS high_earners -FROM employees -GROUP BY department - -UNION ALL - -SELECT - department as department_name, - NULL AS avg_salary, - NULL AS total_employees, - COUNT(*) AS high_earners -FROM employees -WHERE salary > 60000 -GROUP BY department; diff --git a/test/resources/acceptance/cycle__cte.sql b/test/resources/acceptance/cycle__cte.sql deleted file mode 100644 index 1ab5390..0000000 --- a/test/resources/acceptance/cycle__cte.sql +++ /dev/null @@ -1,20 +0,0 @@ --- we eventually want to check that the fields are cycled twice in the attribution of the final outputs. -WITH b AS ( - SELECT - x as y, - y as z, - z as x - FROM a -), -c AS ( - SELECT - x as y, - y as z, - z as x - FROM b -) -SELECT - x, - y, - z -FROM c; diff --git a/test/resources/acceptance/duplicate_scopes.sql b/test/resources/acceptance/duplicate_scopes.sql deleted file mode 100644 index 7162399..0000000 --- a/test/resources/acceptance/duplicate_scopes.sql +++ /dev/null @@ -1,9 +0,0 @@ --- This is a minimal example to illustrate why we need to put an id on each scope. --- As we add more complex compound query tests this will become redundant, and we can then delete it --- we eventually want to check that the fields are cycled twice in the attribution of the final outputs. -WITH b AS (SELECT x FROM a), - c AS (SELECT x FROM a) -SELECT - b.x, - c.x -FROM b, c; diff --git a/test/resources/acceptance/generate_series.sql b/test/resources/acceptance/generate_series.sql deleted file mode 100644 index def9d5c..0000000 --- a/test/resources/acceptance/generate_series.sql +++ /dev/null @@ -1,2 +0,0 @@ -SELECT t.day::date AS date -FROM generate_series(timestamp '2021-01-01', now(), interval '1 day') AS t(day) diff --git a/test/resources/acceptance/literal__with_table.sql b/test/resources/acceptance/literal__with_table.sql deleted file mode 100644 index 40e34fc..0000000 --- a/test/resources/acceptance/literal__with_table.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT FALSE, 'str', 1, x FROM t diff --git a/test/resources/acceptance/literal__without_table.sql b/test/resources/acceptance/literal__without_table.sql deleted file mode 100644 index 497a1b9..0000000 --- a/test/resources/acceptance/literal__without_table.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT FALSE, 'str', 1 diff --git a/test/resources/acceptance/no_source_columns.sql b/test/resources/acceptance/no_source_columns.sql deleted file mode 100644 index db75fbe..0000000 --- a/test/resources/acceptance/no_source_columns.sql +++ /dev/null @@ -1,2 +0,0 @@ -WITH cte AS (SELECT COUNT(*) AS a FROM foo) -SELECT a AS b FROM bar diff --git a/test/resources/acceptance/oracle__open_for.sql b/test/resources/acceptance/oracle__open_for.sql deleted file mode 100644 index f0599f2..0000000 --- a/test/resources/acceptance/oracle__open_for.sql +++ /dev/null @@ -1,5 +0,0 @@ - OPEN ccur FOR - 'select c.category - from ' || TABLE_NAME || ' c - where c.deptid=' || PI_N_Dept || - ' and c.category not in ('|| sExcludeCategories ||')'; diff --git a/test/resources/acceptance/queries.sql b/test/resources/acceptance/queries.sql new file mode 100644 index 0000000..01d1ebd --- /dev/null +++ b/test/resources/acceptance/queries.sql @@ -0,0 +1,296 @@ +-- FIXTURE: between/working +SELECT count(*) +FROM t +WHERE CAST(created_at AS date) BETWEEN DATE '2021-08-01' AND DATE '2021-09-30'; + +-- FIXTURE: bigquery/table-wildcard +SELECT + * +FROM + `project_id.dataset_id.table_*` +WHERE + _TABLE_SUFFIX BETWEEN '20230101' AND '20230131' +LIMIT 1000; + +-- FIXTURE: broken/between +SELECT + date_trunc('month', instance_started)::DATE AS month_started, + avg(time_finished - instance_started) as avg_runtime, + count(*) AS total_instances + FROM usage_stats + WHERE instance_started BETWEEN TIMESTAMP WITH TIME ZONE '2019-01-01 00:00:00.000-08:00' AND NOW(); + GROUP BY month_started; + +-- FIXTURE: broken/filter-where +select + e.instance_id + , percentile_cont(0.75) within group (order by e.running_time) as p75_time + -- the parser trips up on the opening bracket in the `filter (where ...)` clause + , percentile_cont(0.75) within group (order by e.running_time) filter (where e.error = '') as p75_success_time + from execution e + group by 1 + +-- FIXTURE: compound/correlated-subquery +SELECT + e.department as department_name, + (SELECT AVG(salary) FROM employees WHERE department = e.department) AS avg_salary, + (SELECT COUNT(*) FROM employees WHERE department = e.department) AS total_employees, + (SELECT COUNT(*) FROM employees WHERE department = e.department AND salary > 9000) AS high_earners +FROM employees e; + +-- FIXTURE: compound/cte +WITH department_stats AS ( + SELECT + department, + AVG(salary) AS average_salary, + COUNT(*) AS total_employees + FROM employees + GROUP BY department +), +high_earners AS ( + SELECT + department, + COUNT(*) AS high_earners_count + FROM employees + WHERE salary > 9000 + GROUP BY department +) +SELECT + ds.department as department_name, + ds.average_salary as avg_summary, + ds.total_employees, + COALESCE(he.high_earners_count, 0) AS high_earners +FROM department_stats ds +LEFT JOIN high_earners he ON ds.department = he.department; + +-- FIXTURE: compound/cte-deadscope +WITH cte AS ( + SELECT x FROM t1 +) +SELECT x, y FROM t2 + +-- FIXTURE: compound/cte-masking +WITH c AS (SELECT x FROM b), + b AS (SELECT y FROM a), + a AS (SELECT x FROM c) +SELECT a.x, b.y FROM a, b + +-- FIXTURE: compound/cte-nonambiguous +WITH cte AS ( + SELECT x FROM t1 +) +SELECT x, y FROM t2 JOIN cte + +-- FIXTURE: compound/cte-pun +with q as ( + select + id + from + report_card + where + created_at > '2024-01-01' + limit + 1 +) +select + created_at +from + report_dashboardcard dc + join q on dc.card_id = q.id; + +-- FIXTURE: compound/cte-recursive +WITH RECURSIVE hierarchy AS ( + SELECT id, manager_id, name + FROM employees + WHERE manager_id IS NULL + UNION ALL + SELECT e.id, e.manager_id, e.name + FROM employees e + JOIN hierarchy eh ON e.manager_id = eh.id +) +SELECT * FROM hierarchy; + +-- FIXTURE: compound/cte-simple +WITH cte AS (SELECT x FROM t1) SELECT cte.x, y FROM t2 JOIN cte; + +-- FIXTURE: compound/subselect +SELECT + e.department as department_name, + e.average_salary as avg_salary, + e.total_employees, + (SELECT COUNT(*) FROM employees WHERE department = e.department AND salary > 9000) AS high_earners +FROM ( + SELECT + department, + AVG(salary) AS average_salary, + COUNT(*) AS total_employees + FROM employees + GROUP BY department +) e; + +-- FIXTURE: compound/subselect-table-masking +SELECT +CASE WHEN Addr.country = 'US' THEN Addr.state ELSE 'ex-US' END AS state +FROM ( + SELECT DISTINCT + coalesce(Cust.state, Addr.region) AS state, + coalesce(Cust.country, Addr.country) AS country + FROM orders + LEFT JOIN addresses AS Addr ON orders.organization_id = Addr.organization_id + LEFT JOIN customers AS Cust ON orders.customer_id = Cust.id +) AS Addr + +-- FIXTURE: compound/union +SELECT + department as department_name, + AVG(salary) AS avg_salary, + COUNT(*) AS total_employees, + NULL AS high_earners +FROM employees +GROUP BY department + +UNION ALL + +SELECT + department as department_name, + NULL AS avg_salary, + NULL AS total_employees, + COUNT(*) AS high_earners +FROM employees +WHERE salary > 60000 +GROUP BY department; + +-- FIXTURE: cycle/cte +-- we eventually want to check that the fields are cycled twice in the attribution of the final outputs. +WITH b AS ( + SELECT + x as y, + y as z, + z as x + FROM a +), +c AS ( + SELECT + x as y, + y as z, + z as x + FROM b +) +SELECT + x, + y, + z +FROM c; + +-- FIXTURE: duplicate-scopes +-- This is a minimal example to illustrate why we need to put an id on each scope. +-- As we add more complex compound query tests this will become redundant, and we can then delete it +-- we eventually want to check that the fields are cycled twice in the attribution of the final outputs. +WITH b AS (SELECT x FROM a), + c AS (SELECT x FROM a) +SELECT + b.x, + c.x +FROM b, c; + +-- FIXTURE: generate-series +SELECT t.day::date AS date +FROM generate_series(timestamp '2021-01-01', now(), interval '1 day') AS t(day) + +-- FIXTURE: literal/with-table +SELECT FALSE, 'str', 1, x FROM t + +-- FIXTURE: literal/without-table +SELECT FALSE, 'str', 1 + +-- FIXTURE: no-source-columns +WITH cte AS (SELECT COUNT(*) AS a FROM foo) +SELECT a AS b FROM bar + +-- FIXTURE: oracle/open-for +OPEN ccur FOR + 'select c.category + from ' || TABLE_NAME || ' c + where c.deptid=' || PI_N_Dept || + ' and c.category not in ('|| sExcludeCategories ||')'; + +-- FIXTURE: reserved/final +with final as ( + select + id, + amount_paid_cents::float / 100 as amount_paid + from invoice + where not is_deleted + ) + + select * from final + +-- FIXTURE: shadow/subselect +SELECT + e.id, + e.name, + d.name AS department_name, + e.num_employees +FROM ( + SELECT + id, + first_name || ' ' || last_name AS name, + COUNT(*) AS num_employees + FROM employees + GROUP BY first_name, last_name, department_id +) e JOIN departments d ON d.id = e.department_id; + +-- FIXTURE: simple/select-into +SELECT id, name +INTO new_user_summary +FROM user; + +-- FIXTURE: simple/select-star +SELECT * FROM t; + +-- FIXTURE: snowflakelet +SELECT + column_2564, + ( + (column_2563 / column_2561) / 2 + ) * 100, + NVL ( + LEAST ( + column_2562, + ABS(column_2560) + ) / column_2561, + 0 + ), + ( + LEAST ( + SUM(column_2562) OVER ( + ORDER BY + column_7299 ROWS BETWEEN 11 PRECEDING + AND CURRENT ROW + ), + ABS( + SUM(column_2560) OVER ( + ORDER BY + column_7299 ROWS BETWEEN 11 PRECEDING + AND CURRENT ROW + ) + ) + ) + ) / AVG(column_2561) OVER ( + ORDER BY + column_7299 ROWS BETWEEN 11 PRECEDING + AND CURRENT ROW + ) +FROM + table_2559 +ORDER BY + column_7421 ASC + +-- FIXTURE: sqlserver/execute +EXECUTE stmt; + +-- FIXTURE: sqlserver/executesql +EXEC sp_executesql @SQL + +-- FIXTURE: string-concat +SELECT x || y AS z FROM t diff --git a/test/resources/acceptance/reserved__final.sql b/test/resources/acceptance/reserved__final.sql deleted file mode 100644 index b4fb6f4..0000000 --- a/test/resources/acceptance/reserved__final.sql +++ /dev/null @@ -1,9 +0,0 @@ -with final as ( - select - id, - amount_paid_cents::float / 100 as amount_paid - from invoice - where not is_deleted - ) - - select * from final diff --git a/test/resources/acceptance/shadow__subselect.sql b/test/resources/acceptance/shadow__subselect.sql deleted file mode 100644 index e86152f..0000000 --- a/test/resources/acceptance/shadow__subselect.sql +++ /dev/null @@ -1,13 +0,0 @@ -SELECT - e.id, - e.name, - d.name AS department_name, - e.num_employees -FROM ( - SELECT - id, - first_name || ' ' || last_name AS name, - COUNT(*) AS num_employees - FROM employees - GROUP BY first_name, last_name, department_id -) e JOIN departments d ON d.id = e.department_id; diff --git a/test/resources/acceptance/simple__select_into.sql b/test/resources/acceptance/simple__select_into.sql deleted file mode 100644 index 5d2daeb..0000000 --- a/test/resources/acceptance/simple__select_into.sql +++ /dev/null @@ -1,3 +0,0 @@ -SELECT id, name -INTO new_user_summary -FROM user; diff --git a/test/resources/acceptance/simple__select_star.sql b/test/resources/acceptance/simple__select_star.sql deleted file mode 100644 index 8bca937..0000000 --- a/test/resources/acceptance/simple__select_star.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT * FROM t; diff --git a/test/resources/acceptance/snowflakelet.sql b/test/resources/acceptance/snowflakelet.sql deleted file mode 100644 index 0514794..0000000 --- a/test/resources/acceptance/snowflakelet.sql +++ /dev/null @@ -1,36 +0,0 @@ -SELECT - column_2564, - ( - (column_2563 / column_2561) / 2 - ) * 100, - NVL ( - LEAST ( - column_2562, - ABS(column_2560) - ) / column_2561, - 0 - ), - ( - LEAST ( - SUM(column_2562) OVER ( - ORDER BY - column_7299 ROWS BETWEEN 11 PRECEDING - AND CURRENT ROW - ), - ABS( - SUM(column_2560) OVER ( - ORDER BY - column_7299 ROWS BETWEEN 11 PRECEDING - AND CURRENT ROW - ) - ) - ) - ) / AVG(column_2561) OVER ( - ORDER BY - column_7299 ROWS BETWEEN 11 PRECEDING - AND CURRENT ROW - ) -FROM - table_2559 -ORDER BY - column_7421 ASC \ No newline at end of file diff --git a/test/resources/acceptance/sqlserver__execute.sql b/test/resources/acceptance/sqlserver__execute.sql deleted file mode 100644 index f019860..0000000 --- a/test/resources/acceptance/sqlserver__execute.sql +++ /dev/null @@ -1 +0,0 @@ -EXECUTE stmt; diff --git a/test/resources/acceptance/sqlserver__executesql.sql b/test/resources/acceptance/sqlserver__executesql.sql deleted file mode 100644 index 15e05c3..0000000 --- a/test/resources/acceptance/sqlserver__executesql.sql +++ /dev/null @@ -1 +0,0 @@ -EXEC sp_executesql @SQL diff --git a/test/resources/acceptance/string_concat.sql b/test/resources/acceptance/string_concat.sql deleted file mode 100644 index 572dac5..0000000 --- a/test/resources/acceptance/string_concat.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT x || y AS z FROM t