This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 4560ff728ac [fix](tvf) fix FE cannot start when replay `alter view from tvf` (#40872) (#41159) 4560ff728ac is described below commit 4560ff728ac4eb0c4e06b0277f1d59af38bd4964 Author: Mingyu Chen <morning...@163.com> AuthorDate: Tue Sep 24 11:35:21 2024 +0800 [fix](tvf) fix FE cannot start when replay `alter view from tvf` (#40872) (#41159) bp #40872 --------- Co-authored-by: Tiewei Fang <43782773+bepppo...@users.noreply.github.com> --- .../main/java/org/apache/doris/alter/Alter.java | 9 ++--- .../data/external_table_p0/tvf/test_hdfs_tvf.out | 44 ++++++++++++++++++++++ .../external_table_p0/tvf/test_hdfs_tvf.groovy | 26 +++++++++++++ 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java b/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java index a40f0891b0b..9d1dd2de3f9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java @@ -720,13 +720,12 @@ public class Alter { try { String viewName = view.getName(); view.setInlineViewDefWithSqlMode(inlineViewDef, alterViewInfo.getSqlMode()); - try { - view.init(); - } catch (UserException e) { - throw new DdlException("failed to init view stmt, reason=" + e.getMessage()); - } view.setNewFullSchema(newFullSchema); + // We do not need to init view here. + // During the `init` phase, some `Alter-View` statements will access the remote file system, + // but they should not access it during the metadata replay phase. + db.dropTable(viewName); db.createTable(view); diff --git a/regression-test/data/external_table_p0/tvf/test_hdfs_tvf.out b/regression-test/data/external_table_p0/tvf/test_hdfs_tvf.out index de4f8bd579c..bc14cd5a9e1 100644 --- a/regression-test/data/external_table_p0/tvf/test_hdfs_tvf.out +++ b/regression-test/data/external_table_p0/tvf/test_hdfs_tvf.out @@ -616,3 +616,47 @@ string_col text Yes false \N NONE string_col text Yes false \N NONE tinyint_col tinyint Yes false \N NONE +-- !create_view -- +0 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +1 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +10 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +100 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +101 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +102 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +103 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +104 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +105 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +106 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +107 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +108 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +109 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +11 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +110 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +111 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +112 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +113 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +114 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 +115 2 3 4 5 6.6 7.7 8.8 abc def ghiaaaaaa 2020-10-10 2020-10-10 11:12:59 + +-- !alter_view -- +0 +1 +10 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +11 +110 +111 +112 +113 +114 +115 + diff --git a/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy b/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy index 2c2754739a5..209f870b097 100644 --- a/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy +++ b/regression-test/suites/external_table_p0/tvf/test_hdfs_tvf.groovy @@ -277,6 +277,32 @@ suite("test_hdfs_tvf","external,hive,tvf,external_docker") { "column_separator" = ",", "format" = "${format}"); """ + + // test create view from tvf and alter view from tvf + uri = "${defaultFS}" + "/user/doris/preinstalled_data/csv_format_test/all_types.csv" + format = "csv" + sql """ DROP VIEW IF EXISTS test_hdfs_tvf_create_view;""" + sql """ + create view test_hdfs_tvf_create_view as + select * from HDFS( + "uri" = "${uri}", + "hadoop.username" = "${hdfsUserName}", + "column_separator" = ",", + "format" = "${format}") order by c1; + """ + + order_qt_create_view """ select * from test_hdfs_tvf_create_view order by c1 limit 20; """ + + sql """ + alter view test_hdfs_tvf_create_view as + select c1 from HDFS( + "uri" = "${uri}", + "hadoop.username" = "${hdfsUserName}", + "column_separator" = ",", + "format" = "${format}") order by c1; + """ + + order_qt_alter_view """ select * from test_hdfs_tvf_create_view order by c1 limit 20; """ } finally { } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org