-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix](nereids) fix create view and alter view using old parser checki…
…ng (#43263) Problem: Creating a view on a table with materialized views (MV) results in an error: failed to init view stmt. For example, executing the following SQL: create view v1 as select * from t1 index t_mv_mv. Root Cause: The syntax index t_mv_mv is supported only by the new planner and not by the old planner. During the view creation process, regardless of whether the new or old optimizer is used, the process eventually calls the createView method in Env. In the createView method, the persisted SQL of the view is parsed using the old optimizer's parser. If the parsing fails, an error is thrown. As a result, if the SQL for creating a view includes syntax supported only by the new optimizer, an error occurs. Solution: This PR addresses the issue by removing the parsing check from the createView method in Env. Instead, the check is moved to the respective classes responsible for creating views in the new and old optimizers.
- Loading branch information
1 parent
ce55752
commit 21eb247
Showing
11 changed files
with
548 additions
and
423 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
15 changes: 15 additions & 0 deletions
15
regression-test/data/ddl_p0/create_view_nereids/create_view_use_mv.out
This file contains 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 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !create_view_from_mv -- | ||
\N 99.50 99.50 99.50 1 \N \N \N \N 1 \N \N | ||
1 208.70 109.20 99.50 3 1 3 1 1 3 \N \N | ||
2 218.40 109.20 109.20 2 2 2 2 2 1 \N \N | ||
3 298.50 99.50 99.50 3 3 6 3 3 2 \N \N | ||
4 99.50 99.50 99.50 1 \N 4 4 4 1 \N \N | ||
|
||
-- !alter_view_from_mv -- | ||
\N 99.50 99.50 99.50 1 \N \N \N \N 1 \N \N | ||
1 208.70 109.20 99.50 3 1 3 1 1 3 \N \N | ||
2 218.40 109.20 109.20 2 2 2 2 2 1 \N \N | ||
3 298.50 99.50 99.50 3 3 6 3 3 2 \N \N | ||
4 99.50 99.50 99.50 1 \N 4 4 4 1 \N \N | ||
|
Oops, something went wrong.