-
Notifications
You must be signed in to change notification settings - Fork 51
Fix should allow column list before ENGINE in CREATE MATERIALIZED VIEW #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
git-hulk
merged 1 commit into
AfterShip:master
from
sharadgaur:sharad/fix-rmv-column-list-engine
May 15, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
parser/testdata/ddl/create_materialized_view_rmv_depends_on_multi.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| CREATE MATERIALIZED VIEW db1.attrs_rollup_v0 | ||
| REFRESH EVERY 5 MINUTE | ||
| DEPENDS ON db1.metadata_mv_v0, db1.metadata_mv_v1 | ||
| ENGINE = Memory | ||
| AS SELECT DISTINCT | ||
| service_name, | ||
| attr_key, | ||
| 'profiles' AS dataset, | ||
| 'string' AS attr_type | ||
| FROM db1.metadata_v0 |
36 changes: 36 additions & 0 deletions
36
parser/testdata/ddl/create_materialized_view_rmv_engine_with_columns.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| CREATE MATERIALIZED VIEW db1.config_memory_v0 | ||
| REFRESH EVERY 1 SECOND | ||
| ( | ||
| `schedule_id` String, | ||
| `sample_rate` Int8, | ||
| `start_at` DateTime64(9), | ||
| `end_at` DateTime64(9), | ||
| `created_at` DateTime64(9), | ||
| `created_by` String, | ||
| `properties` Map(String, String), | ||
| `cluster_percentage` Float64, | ||
| `schedule_filters` String | ||
| ) | ||
| ENGINE = Memory | ||
| SETTINGS min_rows_to_keep = 250000, max_rows_to_keep = 500000 | ||
| DEFINER = default SQL SECURITY DEFINER | ||
| COMMENT 'test comment' | ||
| AS SELECT | ||
| schedule_id, | ||
| sample_rate, | ||
| start_at, | ||
| end_at, | ||
| created_at, | ||
| created_by, | ||
| properties, | ||
| cluster_percentage, | ||
| schedule_filters | ||
| FROM | ||
| ( | ||
| SELECT | ||
| *, | ||
| row_number() OVER (PARTITION BY schedule_filters ORDER BY created_at DESC) AS rn | ||
| FROM db1.config_v0 | ||
| WHERE schedule_filters != '{}' | ||
| ) | ||
| WHERE rn = 1 |
26 changes: 26 additions & 0 deletions
26
parser/testdata/ddl/format/beautify/create_materialized_view_rmv_depends_on_multi.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| -- Origin SQL: | ||
| CREATE MATERIALIZED VIEW db1.attrs_rollup_v0 | ||
| REFRESH EVERY 5 MINUTE | ||
| DEPENDS ON db1.metadata_mv_v0, db1.metadata_mv_v1 | ||
| ENGINE = Memory | ||
| AS SELECT DISTINCT | ||
| service_name, | ||
| attr_key, | ||
| 'profiles' AS dataset, | ||
| 'string' AS attr_type | ||
| FROM db1.metadata_v0 | ||
|
|
||
|
|
||
| -- Beautify SQL: | ||
| CREATE MATERIALIZED VIEW db1.attrs_rollup_v0 | ||
| REFRESH EVERY 5 MINUTE | ||
| DEPENDS ON db1.metadata_mv_v0, db1.metadata_mv_v1 | ||
| ENGINE = Memory | ||
| AS | ||
| SELECT DISTINCT | ||
| service_name, | ||
| attr_key, | ||
| 'profiles' AS dataset, | ||
| 'string' AS attr_type | ||
| FROM | ||
| db1.metadata_v0; |
82 changes: 82 additions & 0 deletions
82
parser/testdata/ddl/format/beautify/create_materialized_view_rmv_engine_with_columns.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| -- Origin SQL: | ||
| CREATE MATERIALIZED VIEW db1.config_memory_v0 | ||
| REFRESH EVERY 1 SECOND | ||
| ( | ||
| `schedule_id` String, | ||
| `sample_rate` Int8, | ||
| `start_at` DateTime64(9), | ||
| `end_at` DateTime64(9), | ||
| `created_at` DateTime64(9), | ||
| `created_by` String, | ||
| `properties` Map(String, String), | ||
| `cluster_percentage` Float64, | ||
| `schedule_filters` String | ||
| ) | ||
| ENGINE = Memory | ||
| SETTINGS min_rows_to_keep = 250000, max_rows_to_keep = 500000 | ||
| DEFINER = default SQL SECURITY DEFINER | ||
| COMMENT 'test comment' | ||
| AS SELECT | ||
| schedule_id, | ||
| sample_rate, | ||
| start_at, | ||
| end_at, | ||
| created_at, | ||
| created_by, | ||
| properties, | ||
| cluster_percentage, | ||
| schedule_filters | ||
| FROM | ||
| ( | ||
| SELECT | ||
| *, | ||
| row_number() OVER (PARTITION BY schedule_filters ORDER BY created_at DESC) AS rn | ||
| FROM db1.config_v0 | ||
| WHERE schedule_filters != '{}' | ||
| ) | ||
| WHERE rn = 1 | ||
|
|
||
|
|
||
| -- Beautify SQL: | ||
| CREATE MATERIALIZED VIEW db1.config_memory_v0 | ||
| REFRESH EVERY 1 SECOND | ||
| ( | ||
| `schedule_id` String, | ||
| `sample_rate` Int8, | ||
| `start_at` DateTime64(9), | ||
| `end_at` DateTime64(9), | ||
| `created_at` DateTime64(9), | ||
| `created_by` String, | ||
| `properties` Map(String, String), | ||
| `cluster_percentage` Float64, | ||
| `schedule_filters` String | ||
| ) | ||
| ENGINE = Memory | ||
| SETTINGS | ||
| min_rows_to_keep=250000, | ||
| max_rows_to_keep=500000 | ||
| DEFINER = default | ||
| SQL SECURITY DEFINER | ||
| AS | ||
| SELECT | ||
| schedule_id, | ||
| sample_rate, | ||
| start_at, | ||
| end_at, | ||
| created_at, | ||
| created_by, | ||
| properties, | ||
| cluster_percentage, | ||
| schedule_filters | ||
| FROM | ||
| (SELECT | ||
| *, | ||
| row_number() OVER (PARTITION BY schedule_filters ORDER BY | ||
| created_at DESC) AS rn | ||
| FROM | ||
| db1.config_v0 | ||
| WHERE | ||
| schedule_filters != '{}') | ||
| WHERE | ||
| rn = 1 | ||
| COMMENT 'test comment'; |
15 changes: 15 additions & 0 deletions
15
parser/testdata/ddl/format/create_materialized_view_rmv_depends_on_multi.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| -- Origin SQL: | ||
| CREATE MATERIALIZED VIEW db1.attrs_rollup_v0 | ||
| REFRESH EVERY 5 MINUTE | ||
| DEPENDS ON db1.metadata_mv_v0, db1.metadata_mv_v1 | ||
| ENGINE = Memory | ||
| AS SELECT DISTINCT | ||
| service_name, | ||
| attr_key, | ||
| 'profiles' AS dataset, | ||
| 'string' AS attr_type | ||
| FROM db1.metadata_v0 | ||
|
|
||
|
|
||
| -- Format SQL: | ||
| CREATE MATERIALIZED VIEW db1.attrs_rollup_v0 REFRESH EVERY 5 MINUTE DEPENDS ON db1.metadata_mv_v0, db1.metadata_mv_v1 ENGINE = Memory AS SELECT DISTINCT service_name, attr_key, 'profiles' AS dataset, 'string' AS attr_type FROM db1.metadata_v0; |
41 changes: 41 additions & 0 deletions
41
parser/testdata/ddl/format/create_materialized_view_rmv_engine_with_columns.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| -- Origin SQL: | ||
| CREATE MATERIALIZED VIEW db1.config_memory_v0 | ||
| REFRESH EVERY 1 SECOND | ||
| ( | ||
| `schedule_id` String, | ||
| `sample_rate` Int8, | ||
| `start_at` DateTime64(9), | ||
| `end_at` DateTime64(9), | ||
| `created_at` DateTime64(9), | ||
| `created_by` String, | ||
| `properties` Map(String, String), | ||
| `cluster_percentage` Float64, | ||
| `schedule_filters` String | ||
| ) | ||
| ENGINE = Memory | ||
| SETTINGS min_rows_to_keep = 250000, max_rows_to_keep = 500000 | ||
| DEFINER = default SQL SECURITY DEFINER | ||
| COMMENT 'test comment' | ||
| AS SELECT | ||
| schedule_id, | ||
| sample_rate, | ||
| start_at, | ||
| end_at, | ||
| created_at, | ||
| created_by, | ||
| properties, | ||
| cluster_percentage, | ||
| schedule_filters | ||
| FROM | ||
| ( | ||
| SELECT | ||
| *, | ||
| row_number() OVER (PARTITION BY schedule_filters ORDER BY created_at DESC) AS rn | ||
| FROM db1.config_v0 | ||
| WHERE schedule_filters != '{}' | ||
| ) | ||
| WHERE rn = 1 | ||
|
|
||
|
|
||
| -- Format SQL: | ||
| CREATE MATERIALIZED VIEW db1.config_memory_v0 REFRESH EVERY 1 SECOND (`schedule_id` String, `sample_rate` Int8, `start_at` DateTime64(9), `end_at` DateTime64(9), `created_at` DateTime64(9), `created_by` String, `properties` Map(String, String), `cluster_percentage` Float64, `schedule_filters` String) ENGINE = Memory SETTINGS min_rows_to_keep=250000, max_rows_to_keep=500000 DEFINER = default SQL SECURITY DEFINER AS SELECT schedule_id, sample_rate, start_at, end_at, created_at, created_by, properties, cluster_percentage, schedule_filters FROM (SELECT *, row_number() OVER (PARTITION BY schedule_filters ORDER BY created_at DESC) AS rn FROM db1.config_v0 WHERE schedule_filters != '{}') WHERE rn = 1 COMMENT 'test comment'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.