Skip to content

Commit

Permalink
[feat](nereids) support create view in nereids
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei committed Apr 1, 2024
1 parent 9bb9a7e commit 32ba0a7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public Optional<TableIf> getTable() {

@Override
public String toSql() {
// return getQualifiedNameWithBacktick();
return name.get();
}

Expand Down
22 changes: 22 additions & 0 deletions regression-test/data/ddl_p0/test_create_view_nereids.out
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,25 @@ test_view_expression CREATE VIEW `test_view_expression` COMMENT 'VIEW' AS (selec
-- !test_alias_sql --
test_view_alias CREATE VIEW `test_view_alias` COMMENT 'VIEW' AS (\n select c8 AS `c1`, c2 AS `c2`, c1 AS `c3` from (select a+1 c8,abs(a)+2+1 as c2, cast(b as varchar(10)) as c1 from `internal`.`regression_test_ddl_p0`.`mal_test_view`) t); utf8mb4 utf8mb4_0900_bin

-- !test_star_except --
6 \N 6
1 1 2
2 1 3
1 1 4
2 1 4
2 1 7
3 2 8
2 3 5
1 3 6
2 3 9
2 4 2
3 5 \N
3 5 6
3 5 6
4 5 6
3 5 8
6 7 1

-- !test_star_except_sql --
test_view_star_except CREATE VIEW `test_view_star_except` COMMENT 'VIEW' 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 `internal`.`regression_test_ddl_p0`.`mal_test_view`; utf8mb4 utf8mb4_0900_bin

8 changes: 8 additions & 0 deletions regression-test/suites/ddl_p0/test_create_view_nereids.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,12 @@ suite("test_create_view_nereids") {
qt_test_alias "select * from test_view_alias order by c1,c2,c3;"
qt_test_alias_sql "show create view test_view_alias;"

// test * except
sql "drop view if exists test_view_star_except;"
sql """
create view test_view_star_except as select * except(pk) from mal_test_view;
"""
qt_test_star_except "select * from test_view_star_except order by a, b;"
qt_test_star_except_sql "show create view test_view_star_except;"

}

0 comments on commit 32ba0a7

Please sign in to comment.