From 32ba0a7b1fc62548e2da1bc36e317f6af18b52ee Mon Sep 17 00:00:00 2001 From: feiniaofeiafei Date: Mon, 1 Apr 2024 14:39:12 +0800 Subject: [PATCH] [feat](nereids) support create view in nereids --- .../trees/expressions/SlotReference.java | 1 - .../data/ddl_p0/test_create_view_nereids.out | 22 +++++++++++++++++++ .../ddl_p0/test_create_view_nereids.groovy | 8 +++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/SlotReference.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/SlotReference.java index 2c7df32575791f..c63855157d28d0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/SlotReference.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/SlotReference.java @@ -188,7 +188,6 @@ public Optional getTable() { @Override public String toSql() { - // return getQualifiedNameWithBacktick(); return name.get(); } diff --git a/regression-test/data/ddl_p0/test_create_view_nereids.out b/regression-test/data/ddl_p0/test_create_view_nereids.out index 09a573593d6d37..a7795e15e1150d 100644 --- a/regression-test/data/ddl_p0/test_create_view_nereids.out +++ b/regression-test/data/ddl_p0/test_create_view_nereids.out @@ -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 + diff --git a/regression-test/suites/ddl_p0/test_create_view_nereids.groovy b/regression-test/suites/ddl_p0/test_create_view_nereids.groovy index e5a9c56ee4e2a8..33aa19239dc2f1 100644 --- a/regression-test/suites/ddl_p0/test_create_view_nereids.groovy +++ b/regression-test/suites/ddl_p0/test_create_view_nereids.groovy @@ -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;" + }