Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5444,6 +5444,7 @@ public void createView(CreateViewStmt stmt) throws DdlException {
AlterViewStmt alterViewStmt = new AlterViewStmt(stmt.getTableName(), stmt.getColWithComments(),
stmt.getViewDefStmt());
alterViewStmt.setInlineViewDef(stmt.getInlineViewDef());
alterViewStmt.setFinalColumns(stmt.getColumns());
try {
alterView(alterViewStmt);
} catch (UserException e) {
Expand Down
20 changes: 20 additions & 0 deletions regression-test/data/ddl_p0/test_create_or_replace_view.out
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !desc_view_tbl1 --
k1 int Yes true \N
k2 int Yes false \N NONE
v int Yes false \N NONE

-- !desc_view_tbl2 --
k1 int Yes true \N
k2 int Yes false \N NONE
v int Yes false \N NONE

-- !desc_view_upper --
k1 int Yes false \N
k2 int Yes false \N
v int Yes false \N

-- !sql_1 --
1 1 1

-- !sql_2 --
2 2 2

-- !desc_view_upper_after_replace --
k1 int Yes false \N
k2 int Yes false \N
v int Yes false \N

-- !sql_3 --
1 1 1

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ suite("test_create_or_replace_view") {
DUPLICATE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES( "replication_num" = "1");
"""

qt_desc_view_tbl1 """
desc test_create_or_replace_view_tbl1
"""
qt_desc_view_tbl2 """
desc test_create_or_replace_view_tbl2
"""

sql """INSERT INTO test_create_or_replace_view_tbl1 VALUES(1,1,1)"""
sql """INSERT INTO test_create_or_replace_view_tbl2 VALUES(2,2,2)"""
sql "sync"
Expand All @@ -43,6 +51,11 @@ suite("test_create_or_replace_view") {
CREATE VIEW IF NOT EXISTS view_test_create_or_replace_view
AS SELECT * FROM test_create_or_replace_view_tbl1;
"""

qt_desc_view_upper """
desc view_test_create_or_replace_view
"""

qt_sql_1 """select * from view_test_create_or_replace_view"""

// create or replace view in nereids
Expand All @@ -51,6 +64,11 @@ suite("test_create_or_replace_view") {
AS SELECT * FROM test_create_or_replace_view_tbl2;
"""
qt_sql_2 """select * from view_test_create_or_replace_view"""

qt_desc_view_upper_after_replace """
desc view_test_create_or_replace_view
"""

test {
sql """
CREATE OR REPLACE VIEW IF NOT EXISTS view_test_create_or_replace_view
Expand Down
Loading