From 06a096c547370a2725b01dd7c0693ed09d5d2cc0 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Fri, 27 Oct 2023 03:54:56 +0000 Subject: [PATCH 1/8] test: enable integration tests for GlareDB --- prqlc/prql-compiler/src/sql/dialect.rs | 9 ++++----- prqlc/prql-compiler/tests/integration/queries/loop.prql | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/prqlc/prql-compiler/src/sql/dialect.rs b/prqlc/prql-compiler/src/sql/dialect.rs index a73d9eae344d..790622acb2f0 100644 --- a/prqlc/prql-compiler/src/sql/dialect.rs +++ b/prqlc/prql-compiler/src/sql/dialect.rs @@ -83,12 +83,11 @@ impl Dialect { | Dialect::Postgres | Dialect::MySql | Dialect::Generic - | Dialect::ClickHouse => SupportLevel::Supported, - Dialect::MsSql | Dialect::GlareDb - | Dialect::Ansi - | Dialect::BigQuery - | Dialect::Snowflake => SupportLevel::Unsupported, + | Dialect::ClickHouse => SupportLevel::Supported, + Dialect::MsSql | Dialect::Ansi | Dialect::BigQuery | Dialect::Snowflake => { + SupportLevel::Unsupported + } } } diff --git a/prqlc/prql-compiler/tests/integration/queries/loop.prql b/prqlc/prql-compiler/tests/integration/queries/loop.prql index caa7d8019948..7911a200b980 100644 --- a/prqlc/prql-compiler/tests/integration/queries/loop.prql +++ b/prqlc/prql-compiler/tests/integration/queries/loop.prql @@ -1,4 +1,5 @@ # clickhouse:skip (DB::Exception: Syntax error) +# glaredb:skip from [{n = 1}] select n = n - 2 loop (filter n < 4 | select n = n + 1) From 95f918dd766fc85339bc3641e3380a0cdf673a39 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Fri, 27 Oct 2023 04:02:59 +0000 Subject: [PATCH 2/8] fix(test): read_csv for glaredb is not implimented yet --- prqlc/prql-compiler/tests/integration/queries/read_csv.prql | 1 + 1 file changed, 1 insertion(+) diff --git a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql index a805272b3948..d1e2e7a3aca2 100644 --- a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql +++ b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql @@ -1,5 +1,6 @@ # sqlite:skip # postgres:skip # mysql:skip +# glaredb:skip (Not implimented yet) from (read_csv "data_file_root/media_types.csv") sort media_type_id From dedefeebdaa1b4ecabcc2d895e1a9567674e0c69 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 27 Oct 2023 04:03:36 +0000 Subject: [PATCH 3/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- prqlc/prql-compiler/tests/integration/queries/read_csv.prql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql index d1e2e7a3aca2..2c324d8b9f38 100644 --- a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql +++ b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql @@ -1,6 +1,6 @@ # sqlite:skip # postgres:skip # mysql:skip -# glaredb:skip (Not implimented yet) +# glaredb:skip (Not implemented yet) from (read_csv "data_file_root/media_types.csv") sort media_type_id From fb6880ba493895f9673bc0aeced1bc74128ec487 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:20:59 +0000 Subject: [PATCH 4/8] fix(test): skip the switch query test --- prqlc/prql-compiler/tests/integration/queries/switch.prql | 1 + 1 file changed, 1 insertion(+) diff --git a/prqlc/prql-compiler/tests/integration/queries/switch.prql b/prqlc/prql-compiler/tests/integration/queries/switch.prql index 3d3ee5efe217..e017d1a2de8d 100644 --- a/prqlc/prql-compiler/tests/integration/queries/switch.prql +++ b/prqlc/prql-compiler/tests/integration/queries/switch.prql @@ -1,3 +1,4 @@ +# glaredb:skip (May be a bag of String type conversion for Postgres Client) # mssql:test from tracks sort milliseconds From 570f534c15f4f6ef7f42961775ebe5d1dac79fd2 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:36:20 +0000 Subject: [PATCH 5/8] docs(changelog): update about glaredb tests --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51e7c0c6f443..14c880f35116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ **Integrations**: +- Enable integration tests for GlareDB. (@eitsupi, #3749) + **Internal changes**: **New Contributors**: From 1930514f6af3e2cede423aaf0e3cad8421aa66f9 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:38:48 +0000 Subject: [PATCH 6/8] docs(book): sql.glaredb is now supported --- web/book/src/project/target.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/book/src/project/target.md b/web/book/src/project/target.md index 46bc3d45026a..341a3d0a2aef 100644 --- a/web/book/src/project/target.md +++ b/web/book/src/project/target.md @@ -34,6 +34,7 @@ on every commit, and we'll endeavor to fix bugs. - `sql.duckdb` - `sql.generic` {{footnote: while there's no "generic" DB to test `sql.generic` against, we still count it as supported.}} +- `sql.glaredb` - `sql.mysql` - `sql.postgres` - `sql.sqlite` @@ -46,7 +47,6 @@ minimally or not at all, and may have gaps for some features. We're open to contributions to improve our coverage of these, and to adding additional dialects. -- `sql.glaredb` - `sql.mssql` - `sql.ansi` - `sql.bigquery` From 11ad51877b3c3202098cfebbe9a1a6df740da2ec Mon Sep 17 00:00:00 2001 From: eitsupi Date: Fri, 27 Oct 2023 13:42:22 +0000 Subject: [PATCH 7/8] test: add note about glaredb --- prqlc/prql-compiler/tests/integration/queries/loop.prql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prqlc/prql-compiler/tests/integration/queries/loop.prql b/prqlc/prql-compiler/tests/integration/queries/loop.prql index 7911a200b980..c9e3b7156552 100644 --- a/prqlc/prql-compiler/tests/integration/queries/loop.prql +++ b/prqlc/prql-compiler/tests/integration/queries/loop.prql @@ -1,5 +1,5 @@ # clickhouse:skip (DB::Exception: Syntax error) -# glaredb:skip +# glaredb:skip (DataFusion does not support recursive CTEs https://github.com/apache/arrow-datafusion/issues/462) from [{n = 1}] select n = n - 2 loop (filter n < 4 | select n = n + 1) From a44e3947603d7d397c44914b917eb4bbb0ab66f3 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Fri, 27 Oct 2023 14:01:35 +0000 Subject: [PATCH 8/8] feat: `std.sql.read_csv` and `std.sql.read_parquet` for GlareDB --- CHANGELOG.md | 3 +++ prqlc/prql-compiler/src/sql/std.sql.prql | 4 ++++ prqlc/prql-compiler/tests/integration/queries/read_csv.prql | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14c880f35116..03da92e69e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ **Features**: +- The `std.sql.read_csv` function and the `std.sql.read_parquet` function + supports the `sql.glaredb` target. (@eitsupi, #3749) + **Fixes**: **Documentation**: diff --git a/prqlc/prql-compiler/src/sql/std.sql.prql b/prqlc/prql-compiler/src/sql/std.sql.prql index 60cf51cef165..347b374950d8 100644 --- a/prqlc/prql-compiler/src/sql/std.sql.prql +++ b/prqlc/prql-compiler/src/sql/std.sql.prql @@ -211,6 +211,10 @@ module glaredb { @{binding_strength=9} let regex_search = text pattern -> s"{text} ~ {pattern}" + + let read_csv = source -> s"csv_scan({source:0})" + + let read_parquet = source -> s"parquet_scan({source:0})" } module sqlite { diff --git a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql index 2c324d8b9f38..a805272b3948 100644 --- a/prqlc/prql-compiler/tests/integration/queries/read_csv.prql +++ b/prqlc/prql-compiler/tests/integration/queries/read_csv.prql @@ -1,6 +1,5 @@ # sqlite:skip # postgres:skip # mysql:skip -# glaredb:skip (Not implemented yet) from (read_csv "data_file_root/media_types.csv") sort media_type_id