forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat](nereids) support create view in nereids
- Loading branch information
1 parent
a3c470d
commit 4cf6fdd
Showing
5 changed files
with
424 additions
and
4 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
140 changes: 140 additions & 0 deletions
140
regression-test/data/ddl_p0/test_create_view_nereids.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,140 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !test_view_1 -- | ||
1 [1, 2, 3] | ||
2 [10, -2, 8] | ||
3 [-1, 20, 0] | ||
|
||
-- !test_view_2 -- | ||
1 [1, 2, 3] [1, 1, 1] | ||
2 [10, -2, 8] [1, 0, 1] | ||
3 [-1, 20, 0] [0, 1, 0] | ||
|
||
-- !test_view_3 -- | ||
1 [1, 2, 3] [1, 2, 3] [1, 2, 3] | ||
2 [10, -2, 8] [10, 8] [10, 8] | ||
3 [-1, 20, 0] [20] [20] | ||
|
||
-- !test_view_4 -- | ||
1 [1, 2, 3] [1, 2, 3] [1, 2, 3] | ||
2 [10, -2, 8] [10, 8] [10, 8] | ||
3 [-1, 20, 0] [20] [20] | ||
|
||
-- !test_view_5 -- | ||
1 [1, 2, 3] [1, 1, 1] | ||
2 [10, -2, 8] [1, 0, 1] | ||
3 [-1, 20, 0] [0, 1, 0] | ||
|
||
-- !test_view_6 -- | ||
v1 CREATE VIEW `v1` COMMENT 'VIEW' AS SELECT\n `regression_test_ddl_p0`.`view_column_name_test_nereids`.`error_code` AS `error_code`, 1 AS `1`, 'string' AS `'string'`, now() AS `now()`, dayofyear(`regression_test_ddl_p0`.`view_column_name_test_nereids`.`op_time`) AS `dayofyear(``regression_test_ddl_p0``.``view_column_name_test_nereids``.``op_time``)`, cast(`regression_test_ddl_p0`.`view_column_name_test_nereids`.`source` as BIGINT) AS `cast(``regression_test_ddl_p0``.``view_column_name_test_nereids``.``source`` as BIGINT)`, min(`regression_test_ddl_p0`.`view_column_name_test_nereids`.`timestamp`) OVER(ORDER BY `regression_test_ddl_p0`.`view_column_name_test_nereids`.`op_time` desc ROWS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING) AS `min(``regression_test_ddl_p0``.``view_column_name_test_nereids``.``timestamp``) OVER(ORDER BY ``regression_test_ddl_p0``.``view_column_name_test_nereids``.``op_time`` desc ROWS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING)`, (1 > 2) AS `(1 > 2)`, (2 + 3) AS `(2 + 3)`, 1 IN (1, 2, 3, 4) AS `1 IN (1, 2, 3, 4)`, (`regression_test_ddl_p0`.`view_column_name_test_nereids`.`remark` like '%like') AS `(``regression_test_ddl_p0``.``view_column_name_test_nereids``.``remark`` like '%like')`, CASE WHEN (`regression_test_ddl_p0`.`view_column_name_test_nereids`.`remark` = 's') THEN 1 ELSE 2 END AS `CASE WHEN (``regression_test_ddl_p0``.``view_column_name_test_nereids``.``remark`` = 's') THEN 1 ELSE 2 END`, (cast(TRUE as TINYINT) | cast(FALSE as TINYINT)) AS `(cast(TRUE as TINYINT) | cast(FALSE as TINYINT))` \n FROM \n view_column_name_test_nereids; | ||
|
||
-- !test_with_as -- | ||
1 1 2 | ||
1 1 4 | ||
1 3 6 | ||
2 1 3 | ||
2 1 4 | ||
2 1 7 | ||
2 3 5 | ||
2 3 9 | ||
2 4 2 | ||
3 2 8 | ||
3 5 \N | ||
3 5 6 | ||
3 5 6 | ||
3 5 8 | ||
4 5 6 | ||
6 \N 6 | ||
6 7 1 | ||
|
||
-- !test_with_as_sql -- | ||
test_view_with_as CREATE VIEW `test_view_with_as` COMMENT 'VIEW' AS (\n with t1 as (select `regression_test_ddl_p0`.`mal_test_view`.`pk`, `regression_test_ddl_p0`.`mal_test_view`.`a`, `regression_test_ddl_p0`.`mal_test_view`.`b` from mal_test_view), t2 as (select `regression_test_ddl_p0`.`mal_test_view`.`pk`, `regression_test_ddl_p0`.`mal_test_view`.`a`, `regression_test_ddl_p0`.`mal_test_view`.`b` from mal_test_view), \n t3 as (select `regression_test_ddl_p0`.`mal_test_view`.`pk`, `regression_test_ddl_p0`.`mal_test_view`.`a`, `regression_test_ddl_p0`.`mal_test_view`.`b` from mal_test_view) SELECT `t1`.`pk` AS `pk`, `t1`.`a` AS `a`, `t1`.`b` AS `b` FROM t1); utf8mb4 utf8mb4_0900_bin | ||
|
||
-- !test_union -- | ||
1 1 2 | ||
1 1 2 | ||
1 1 4 | ||
1 1 4 | ||
1 3 6 | ||
1 3 6 | ||
2 1 3 | ||
2 1 3 | ||
2 1 4 | ||
2 1 4 | ||
2 1 7 | ||
2 1 7 | ||
2 3 5 | ||
2 3 5 | ||
2 3 9 | ||
2 3 9 | ||
2 4 2 | ||
2 4 2 | ||
3 2 8 | ||
3 2 8 | ||
3 5 \N | ||
3 5 \N | ||
3 5 6 | ||
3 5 6 | ||
3 5 6 | ||
3 5 6 | ||
3 5 8 | ||
3 5 8 | ||
4 5 6 | ||
4 5 6 | ||
6 \N 6 | ||
6 \N 6 | ||
6 7 1 | ||
6 7 1 | ||
|
||
-- !test_union_sql -- | ||
test_view_union CREATE VIEW `test_view_union` COMMENT 'VIEW' AS (\nselect `regression_test_ddl_p0`.`mal_test_view`.`pk` AS `c1`, `regression_test_ddl_p0`.`mal_test_view`.`a` AS `c2`, `regression_test_ddl_p0`.`mal_test_view`.`b` AS `c3` from mal_test_view Union all SELECT * FROM mal_test_view); utf8mb4 utf8mb4_0900_bin | ||
|
||
-- !test_count_star -- | ||
17 | ||
|
||
-- !test_count_star_sql -- | ||
test_view_count_star CREATE VIEW `test_view_count_star` COMMENT 'VIEW' AS (select count(*) AS `c1` from mal_test_view having count(*) > 0); utf8mb4 utf8mb4_0900_bin | ||
|
||
-- !test_expression -- | ||
\N \N 6 | ||
2 4 2 | ||
2 4 3 | ||
2 4 4 | ||
2 4 4 | ||
2 4 7 | ||
3 5 8 | ||
4 6 5 | ||
4 6 6 | ||
4 6 9 | ||
5 7 2 | ||
6 8 \N | ||
6 8 6 | ||
6 8 6 | ||
6 8 6 | ||
6 8 8 | ||
8 10 1 | ||
|
||
-- !test_expression_sql -- | ||
test_view_expression CREATE VIEW `test_view_expression` COMMENT 'VIEW' AS (select (`regression_test_ddl_p0`.`mal_test_view`.`a` + 1) AS `c1`, ((abs(`regression_test_ddl_p0`.`mal_test_view`.`a`) + 2) + 1) AS `c2`, substring(cast(`regression_test_ddl_p0`.`mal_test_view`.`b` as VARCHAR(10)), 1, 10) AS `c3` from mal_test_view); utf8mb4 utf8mb4_0900_bin | ||
|
||
-- !test_alias -- | ||
\N \N 6 | ||
2 4 2 | ||
2 4 3 | ||
2 4 4 | ||
2 4 4 | ||
2 4 7 | ||
3 5 8 | ||
4 6 5 | ||
4 6 6 | ||
4 6 9 | ||
5 7 2 | ||
6 8 \N | ||
6 8 6 | ||
6 8 6 | ||
6 8 6 | ||
6 8 8 | ||
8 10 1 | ||
|
||
-- !test_alias_sql -- | ||
test_view_alias CREATE VIEW `test_view_alias` COMMENT 'VIEW' AS (\n select `t`.`c8` AS `c1`, `t`.`c2` AS `c2`, `t`.`c1` AS `c3` from (select a+1 c8,abs(a)+2+1 as c2, cast(b as varchar(10)) as c1 from mal_test_view) t); utf8mb4 utf8mb4_0900_bin | ||
|
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
Oops, something went wrong.