This is an automated email from the ASF dual-hosted git repository.

starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 18ea0da19c9 [Chore](nereids) Remove ShowViewStmt (#51616)
18ea0da19c9 is described below

commit 18ea0da19c92608d81f8a27366666b1a6b15c65b
Author: Jensen <czjour...@163.com>
AuthorDate: Wed Jun 11 10:25:17 2025 +0800

    [Chore](nereids) Remove ShowViewStmt (#51616)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |   4 -
 .../org/apache/doris/analysis/ShowViewStmt.java    | 141 -----------
 .../java/org/apache/doris/qe/ShowExecutor.java     |  23 --
 .../apache/doris/analysis/ShowViewStmtTest.java    | 263 ---------------------
 .../java/org/apache/doris/qe/ShowExecutorTest.java |  15 +-
 5 files changed, 10 insertions(+), 436 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 9ee4ba69621..f6ad57af83b 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -4591,10 +4591,6 @@ show_param ::=
     {:
         RESULT = new ShowIndexStmt(dbName, dbTblName);
     :}
-    | KW_VIEW from_or_in table_name:dbTblName opt_db:dbName
-    {:
-        RESULT = new ShowViewStmt(dbName, dbTblName);
-    :}
     | KW_TRANSACTION opt_db:dbName opt_wild_where
     {:
         RESULT = new ShowTransactionStmt(dbName, parser.where);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowViewStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowViewStmt.java
deleted file mode 100644
index f8cf26ed1bd..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowViewStmt.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.catalog.Column;
-import org.apache.doris.catalog.Database;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.ScalarType;
-import org.apache.doris.catalog.Table;
-import org.apache.doris.catalog.View;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.ShowResultSetMetaData;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import java.util.List;
-import java.util.Set;
-
-// Show view statement, used to show view information of one table.
-//
-// Syntax:
-//      SHOW VIEW { FROM | IN } table [ FROM db ]
-public class ShowViewStmt extends ShowStmt implements NotFallbackInParser {
-    private static final ShowResultSetMetaData META_DATA =
-            ShowResultSetMetaData.builder()
-                    .addColumn(new Column("View", 
ScalarType.createVarchar(30)))
-                    .addColumn(new Column("Create View", 
ScalarType.createVarchar(65535)))
-                    .build();
-
-    private String db;
-    private TableName tbl;
-
-    private List<View> matchViews = Lists.newArrayList();
-
-    public ShowViewStmt(String db, TableName tbl) {
-        this.db = db;
-        this.tbl = tbl;
-    }
-
-    public String getDb() {
-        return tbl.getDb();
-    }
-
-    public String getTbl() {
-        return tbl.getTbl();
-    }
-
-    public List<View> getMatchViews() {
-        return matchViews;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws AnalysisException, 
UserException {
-        super.analyze(analyzer);
-        if (tbl == null) {
-            ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_TABLES_USED);
-        }
-        if (!Strings.isNullOrEmpty(db)) {
-            // if user specify the `from db`, overwrite the db in `tbl` with 
this db.
-            // for example:
-            //      show view from db1.tbl1 from db2;
-            // will be rewrote to:
-            //      show view from db2.tbl1;
-            // this act same as in MySQL
-            tbl.setDb(db);
-        }
-        tbl.analyze(analyzer);
-        // disallow external catalog
-        Util.prohibitExternalCatalog(tbl.getCtl(), 
this.getClass().getSimpleName());
-
-        String dbName = tbl.getDb();
-        if (!Env.getCurrentEnv().getAccessManager().checkTblPriv(
-                ConnectContext.get(), tbl.getCtl(), dbName, getTbl(), 
PrivPredicate.SHOW)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, 
"SHOW VIEW",
-                    ConnectContext.get().getQualifiedUser(),
-                    ConnectContext.get().getRemoteIP(),
-                    dbName + ": " + getTbl());
-        }
-
-        Database database = 
Env.getCurrentInternalCatalog().getDbOrAnalysisException(dbName);
-        database.getOlapTableOrAnalysisException(tbl.getTbl());
-        for (Table table : database.getViews()) {
-            View view = (View) table;
-            List<TableRef> tblRefs = Lists.newArrayList();
-            // get table refs instead of get tables because it don't need to 
check table's validity
-            getTableRefs(analyzer, view, tblRefs);
-            for (TableRef tblRef : tblRefs) {
-                tblRef.getName().analyze(analyzer);
-                if (tblRef.getName().equals(tbl)) {
-                    matchViews.add(view);
-                }
-            }
-        }
-    }
-
-    private void getTableRefs(Analyzer analyzer, View view, List<TableRef> 
tblRefs) {
-        Set<String> parentViewNameSet = Sets.newHashSet();
-        QueryStmt queryStmt = view.getQueryStmt();
-        queryStmt.getTableRefs(analyzer, tblRefs, parentViewNameSet);
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder("SHOW VIEW FROM ");
-        sb.append(tbl.toSql());
-        return sb.toString();
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public ShowResultSetMetaData getMetaData() {
-        return META_DATA;
-    }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
index f99fbf562b8..3087fbba061 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -111,7 +111,6 @@ import org.apache.doris.analysis.ShowTrashStmt;
 import org.apache.doris.analysis.ShowTypeCastStmt;
 import org.apache.doris.analysis.ShowUserPropertyStmt;
 import org.apache.doris.analysis.ShowVariablesStmt;
-import org.apache.doris.analysis.ShowViewStmt;
 import org.apache.doris.analysis.ShowWorkloadGroupsStmt;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.backup.AbstractJob;
@@ -424,8 +423,6 @@ public class ShowExecutor {
             handleShowDynamicPartition();
         } else if (stmt instanceof ShowIndexStmt) {
             handleShowIndex();
-        } else if (stmt instanceof ShowViewStmt) {
-            handleShowView();
         } else if (stmt instanceof ShowTransactionStmt) {
             handleShowTransaction();
         } else if (stmt instanceof ShowPluginsStmt) {
@@ -1251,26 +1248,6 @@ public class ShowExecutor {
         resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
     }
 
-    // Show view statement.
-    private void handleShowView() {
-        ShowViewStmt showStmt = (ShowViewStmt) stmt;
-        List<List<String>> rows = Lists.newArrayList();
-        List<View> matchViews = showStmt.getMatchViews();
-        for (View view : matchViews) {
-            view.readLock();
-            try {
-                List<String> createViewStmt = Lists.newArrayList();
-                Env.getDdlStmt(view, createViewStmt, null, null, false, true 
/* hide password */, -1L);
-                if (!createViewStmt.isEmpty()) {
-                    rows.add(Lists.newArrayList(view.getName(), 
createViewStmt.get(0)));
-                }
-            } finally {
-                view.readUnlock();
-            }
-        }
-        resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
-    }
-
     // Handle help statement.
     private void handleHelp() {
         HelpStmt helpStmt = (HelpStmt) stmt;
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowViewStmtTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowViewStmtTest.java
deleted file mode 100644
index 21e0ef36987..00000000000
--- a/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowViewStmtTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.SqlParserUtils;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.ShowExecutor;
-import org.apache.doris.qe.ShowResultSet;
-import org.apache.doris.utframe.DorisAssert;
-import org.apache.doris.utframe.UtFrameUtils;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-public class ShowViewStmtTest {
-    private static final String internalCtl = 
InternalCatalog.INTERNAL_CATALOG_NAME;
-    private static String runningDir = "fe/mocked/ShowViewTest/" + 
UUID.randomUUID().toString() + "/";
-    private static DorisAssert dorisAssert;
-
-    @AfterClass
-    public static void tearDown() throws Exception {
-        UtFrameUtils.cleanDorisFeDir(runningDir);
-    }
-
-    @BeforeClass
-    public static void setUp() throws Exception {
-        UtFrameUtils.createDorisCluster(runningDir);
-        String testTbl1 = "CREATE TABLE `test1` (\n"
-                + "  `a` int(11) NOT NULL COMMENT \"\",\n"
-                + "  `b` int(11) NOT NULL COMMENT \"\"\n"
-                + ") ENGINE=OLAP\n"
-                + "UNIQUE KEY(`a`)\n"
-                + "COMMENT \"OLAP\"\n"
-                + "DISTRIBUTED BY HASH(`a`) BUCKETS 8\n"
-                + "PROPERTIES (\n"
-                + "\"replication_num\" = \"1\",\n"
-                + "\"in_memory\" = \"false\",\n"
-                + "\"storage_format\" = \"V2\"\n"
-                + ");";
-        String testTbl2 = "CREATE TABLE `test2` (\n"
-                + "  `c` int(11) NOT NULL COMMENT \"\",\n"
-                + "  `d` int(11) NOT NULL COMMENT \"\"\n"
-                + ") ENGINE=OLAP\n"
-                + "UNIQUE KEY(`c`)\n"
-                + "COMMENT \"OLAP\"\n"
-                + "DISTRIBUTED BY HASH(`c`) BUCKETS 8\n"
-                + "PROPERTIES (\n"
-                + "\"replication_num\" = \"1\",\n"
-                + "\"in_memory\" = \"false\",\n"
-                + "\"storage_format\" = \"V2\"\n"
-                + ");";
-        String testTbl3 = "CREATE TABLE `test3` (\n"
-                + "  `e` int(11) NOT NULL COMMENT \"\",\n"
-                + "  `f` int(11) NOT NULL COMMENT \"\"\n"
-                + ") ENGINE=OLAP\n"
-                + "UNIQUE KEY(`e`)\n"
-                + "COMMENT \"OLAP\"\n"
-                + "DISTRIBUTED BY HASH(`e`) BUCKETS 8\n"
-                + "PROPERTIES (\n"
-                + "\"replication_num\" = \"1\",\n"
-                + "\"in_memory\" = \"false\",\n"
-                + "\"storage_format\" = \"V2\"\n"
-                + ");";
-
-        dorisAssert = new DorisAssert();
-        dorisAssert.withDatabase("testDb").useDatabase("testDb");
-        dorisAssert.withTable(testTbl1)
-                   .withTable(testTbl2)
-                   .withTable(testTbl3);
-    }
-
-    @Test
-    public void testNormal() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "test1"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        Assert.assertEquals("SHOW VIEW FROM `testDb`.`test1`", 
stmt.toString());
-        Assert.assertEquals("testDb", stmt.getDb());
-        Assert.assertEquals("test1", stmt.getTbl());
-        Assert.assertEquals(2, stmt.getMetaData().getColumnCount());
-        Assert.assertEquals("View", stmt.getMetaData().getColumn(0).getName());
-        Assert.assertEquals("Create View", 
stmt.getMetaData().getColumn(1).getName());
-    }
-
-    @Test(expected = UserException.class)
-    public void testNoDb() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"", "testTbl"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        Assert.fail();
-    }
-
-    @Test
-    public void testShowView() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        String testView1 = "CREATE VIEW `view1` as \n"
-                + "SELECT a, b FROM test1;";
-        dorisAssert.withView(testView1);
-
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "test1"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        ShowExecutor executor = new ShowExecutor(ctx, stmt);
-        ShowResultSet resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view1", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        dorisAssert.dropView("view1");
-    }
-
-    @Test
-    public void testShowViewWithJoin() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        String testView2 = "CREATE VIEW `view2` as \n"
-                + "SELECT a, c FROM test1 \n"
-                + "LEFT OUTER JOIN test2 \n"
-                + "ON test1.a = test2.c;";
-        dorisAssert.withView(testView2);
-
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "test1"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        ShowExecutor executor = new ShowExecutor(ctx, stmt);
-        ShowResultSet resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view2", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        stmt = new ShowViewStmt("", new TableName(internalCtl, "testDb", 
"test2"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        executor = new ShowExecutor(ctx, stmt);
-        resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view2", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        dorisAssert.dropView("view2");
-    }
-
-    @Test
-    public void testShowViewWithNestedSqlView() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        String testView3 = "CREATE VIEW `view3` as \n"
-                + "SELECT a, d FROM test1 \n"
-                + "LEFT OUTER JOIN \n"
-                + "(SELECT d, e FROM test3 LEFT OUTER JOIN test2 ON test3.e = 
test2.c) test4 \n"
-                + "ON test1.a = test4.e;";
-        dorisAssert.withView(testView3);
-
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "test1"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        ShowExecutor executor = new ShowExecutor(ctx, stmt);
-        ShowResultSet resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view3", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        stmt = new ShowViewStmt("", new TableName(internalCtl, "testDb", 
"test2"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        executor = new ShowExecutor(ctx, stmt);
-        resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view3", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        stmt = new ShowViewStmt("", new TableName(internalCtl, "testDb", 
"test3"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        executor = new ShowExecutor(ctx, stmt);
-        resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(1, resultSet.getResultRows().size());
-        Assert.assertTrue(resultSet.next());
-        Assert.assertEquals("view3", resultSet.getString(0));
-        Assert.assertFalse(resultSet.next());
-
-        dorisAssert.dropView("view3");
-    }
-
-    @Test
-    public void testShowViewWithNestedView() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        String testView4 = "CREATE VIEW `view4` as \n"
-                + "SELECT a, b FROM test1;";
-        String testView5 = "CREATE VIEW `view5` as \n"
-                + "SELECT c FROM test2 \n"
-                + "LEFT OUTER JOIN view4 \n"
-                + "ON test2.c = view4.a;";
-        dorisAssert.withView(testView4);
-        dorisAssert.withView(testView5);
-
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "test1"));
-        stmt.analyze(new Analyzer(ctx.getEnv(), ctx));
-        ShowExecutor executor = new ShowExecutor(ctx, stmt);
-        ShowResultSet resultSet = executor.execute();
-        System.out.println(resultSet.getResultRows());
-        Assert.assertEquals(2, resultSet.getResultRows().size());
-        List<String> views = Arrays.asList("view4", "view5");
-        Assert.assertTrue(resultSet.next());
-        Assert.assertTrue(views.contains(resultSet.getString(0)));
-        Assert.assertTrue(resultSet.next());
-        Assert.assertTrue(views.contains(resultSet.getString(0)));
-
-        dorisAssert.dropView("view4")
-                   .dropView("view5");
-    }
-
-    @Test
-    public void testGetTableRefs() throws Exception {
-        ConnectContext ctx = UtFrameUtils.createDefaultCtx();
-        String sql = "with w as (select a from testDb.test1) "
-                + "select c, d from testDb.test2 "
-                + "left outer join "
-                + "(select e from testDb.test3 join w on testDb.test3.e = w.a) 
test4 "
-                + "on test1.b = test4.d";
-        SqlScanner input = new SqlScanner(new StringReader(sql));
-        SqlParser parser = new SqlParser(input);
-        QueryStmt queryStmt = (QueryStmt) SqlParserUtils.getFirstStmt(parser);
-        List<TableRef> tblRefs = Lists.newArrayList();
-        Set<String> parentViewNameSet = Sets.newHashSet();
-        queryStmt.getTableRefs(new Analyzer(ctx.getEnv(), ctx), tblRefs, 
parentViewNameSet);
-
-        Assert.assertEquals(3, tblRefs.size());
-        Assert.assertEquals("test1", tblRefs.get(0).getName().getTbl());
-        Assert.assertEquals("test2", tblRefs.get(1).getName().getTbl());
-        Assert.assertEquals("test3", tblRefs.get(2).getName().getTbl());
-    }
-}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/ShowExecutorTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/qe/ShowExecutorTest.java
index 42bcdf3ea4d..3dfbbc3bc3a 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/ShowExecutorTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/qe/ShowExecutorTest.java
@@ -32,7 +32,6 @@ import org.apache.doris.analysis.ShowProcedureStmt;
 import org.apache.doris.analysis.ShowSqlBlockRuleStmt;
 import org.apache.doris.analysis.ShowTableStmt;
 import org.apache.doris.analysis.ShowVariablesStmt;
-import org.apache.doris.analysis.ShowViewStmt;
 import org.apache.doris.analysis.TableName;
 import org.apache.doris.analysis.UserIdentity;
 import org.apache.doris.catalog.Column;
@@ -57,6 +56,8 @@ import org.apache.doris.datasource.InternalCatalog;
 import org.apache.doris.mysql.MysqlCommand;
 import org.apache.doris.mysql.privilege.AccessControllerManager;
 import org.apache.doris.nereids.trees.plans.commands.ShowDatabasesCommand;
+import org.apache.doris.nereids.trees.plans.commands.ShowViewCommand;
+import org.apache.doris.nereids.trees.plans.commands.info.TableNameInfo;
 import org.apache.doris.qe.help.HelpModule;
 import org.apache.doris.system.SystemInfoService;
 import org.apache.doris.thrift.TStorageType;
@@ -545,10 +546,14 @@ public class ShowExecutorTest {
     public void testShowView() throws UserException {
         ctx.setEnv(env);
         ctx.setQualifiedUser("testUser");
-        ShowViewStmt stmt = new ShowViewStmt("", new TableName(internalCtl, 
"testDb", "testTbl"));
-        stmt.analyze(AccessTestUtil.fetchAdminAnalyzer(true));
-        ShowExecutor executor = new ShowExecutor(ctx, stmt);
-        ShowResultSet resultSet = executor.execute();
+        TableNameInfo tableNameInfo = new TableNameInfo(internalCtl, "testDb", 
"testTbl");
+        ShowViewCommand command = new ShowViewCommand("testDb", tableNameInfo);
+        ShowResultSet resultSet = null;
+        try {
+            resultSet = command.doRun(ctx, new StmtExecutor(ctx, ""));
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
 
         Assert.assertFalse(resultSet.next());
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to