From 7806607ac282a371f2457bee16966e5349794e73 Mon Sep 17 00:00:00 2001 From: Yulei-Yang Date: Tue, 5 Dec 2023 11:29:35 +0800 Subject: [PATCH 1/3] [feature](analyze_cmd) add show-analyze-tablets stmt for analyzing a batch of tablet-ids --- .../Show-Statements/SHOW-ANALYZE-TABLETS.md | 74 +++++++++++++++ docs/sidebars.json | 4 +- .../Show-Statements/SHOW-ANALYZE-TABLETS.md | 74 +++++++++++++++ fe/fe-core/src/main/cup/sql_parser.cup | 4 + .../analysis/ShowAnalyzeTabletsStmt.java | 94 +++++++++++++++++++ .../org/apache/doris/qe/ShowExecutor.java | 61 ++++++++++++ 6 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md create mode 100644 docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md create mode 100644 fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java diff --git a/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md new file mode 100644 index 00000000000000..f271e80bd0cf14 --- /dev/null +++ b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md @@ -0,0 +1,74 @@ +--- +{ + "title": "SHOW-ANALYZE-TABLETS", + "language": "en" +} +--- + + + + + +## SHOW-ANALYZE-TABLETS + + + +### Name + +SHOW ANALYZE TABLETS + +### Description + +Used to show tablets and information of their belonging table + +grammar: + +```sql +SHOW ANALYZE TABLETS tablet-ids; +``` + +illustrate: + +1. tablet-ids:one or more tablet-ids, with comma separated +2. Columns of result keep same with result of `SHOW-DATA` for the same table + +### Example + +1. show information of four tablet-ids (actually, three tablet-ids. Result will be deduplicated) + + ```sql + SHOW ANALYZE TABLETS 27028,78880,78382,27028; + ``` + + ``` ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ +| DbName | TableName | TableSize | PartitionNum | BucketNum | ReplicaCount | TabletIds | ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ +| default_cluster:db1 | kec | 613.000 B | 379 | 604 | 604 | [78880, 78382] | +| default_cluster:db1 | test | 1.874 KB | 1 | 1 | 1 | [27028] | ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ + ``` + +### Keywords + + SHOW, ANALYZE, TABLETS + +### Best Practice + diff --git a/docs/sidebars.json b/docs/sidebars.json index 4db8f541361405..d216c95b8104ca 100644 --- a/docs/sidebars.json +++ b/docs/sidebars.json @@ -867,7 +867,8 @@ "sql-manual/sql-reference/Database-Administration-Statements/RECOVER", "sql-manual/sql-reference/Database-Administration-Statements/KILL", "sql-manual/sql-reference/Database-Administration-Statements/ADMIN-REBALANCE-DISK", - "sql-manual/sql-reference/Database-Administration-Statements/ADMIN-CANCEL-REBALANCE-DISK" + "sql-manual/sql-reference/Database-Administration-Statements/ADMIN-CANCEL-REBALANCE-DISK", + "sql-manual/sql-reference/Database-Administration-Statements/UNSET-VARIABLE" ] }, { @@ -1024,6 +1025,7 @@ "type": "category", "label": "Show", "items": [ + "sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS", "sql-manual/sql-reference/Show-Statements/SHOW-ALTER-TABLE-MATERIALIZED-VIEW", "sql-manual/sql-reference/Show-Statements/SHOW-ALTER", "sql-manual/sql-reference/Show-Statements/SHOW-BACKUP", diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md new file mode 100644 index 00000000000000..1b80fbd464b19d --- /dev/null +++ b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md @@ -0,0 +1,74 @@ +--- +{ + "title": "SHOW-ANALYZE-TABLETS", + "language": "zh-CN" +} +--- + + + + + +## SHOW-ANALYZE-TABLETS + + + +### Name + +SHOW ANALYZE TABLETS + +### Description + +该语句用于展示指定Tablets归属的表的信息 + +语法: + +```sql +SHOW ANALYZE TABLETS tablet-ids; +``` + +说明: + +1. tablet-ids:指一到多个tablet-id构成的列表。如有多个,使用逗号分隔 +2. 结果中 table 相关的信息和 `SHOW-DATA` 语句的口径一致 + +### Example + +1. 展示3个tablet-id的相关信息(tablet-id可去重) + + ```sql + SHOW ANALYZE TABLETS 27028,78880,78382,27028; + ``` + + ``` ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ +| DbName | TableName | TableSize | PartitionNum | BucketNum | ReplicaCount | TabletIds | ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ +| default_cluster:db1 | kec | 613.000 B | 379 | 604 | 604 | [78880, 78382] | +| default_cluster:db1 | test | 1.874 KB | 1 | 1 | 1 | [27028] | ++---------------------+-----------+-----------+--------------+-----------+--------------+----------------+ + ``` + +### Keywords + + SHOW, ANALYZE, TABLETS + +### Best Practice + diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup index 3a7b5b1b5fc5d4..c3833ace11888e 100644 --- a/fe/fe-core/src/main/cup/sql_parser.cup +++ b/fe/fe-core/src/main/cup/sql_parser.cup @@ -4152,6 +4152,10 @@ show_param ::= {: RESULT = new ShowAnalyzeTaskStatus(jobId); :} + | KW_ANALYZE KW_TABLETS integer_list:tabletIds + {: + RESULT = new ShowAnalyzeTabletsStmt(tabletIds); + :} | KW_CATALOG KW_RECYCLE KW_BIN opt_wild_where {: RESULT = new ShowCatalogRecycleBinStmt(parser.where); diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java new file mode 100644 index 00000000000000..bf5d41c724e8a8 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java @@ -0,0 +1,94 @@ +// 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.ScalarType; +import org.apache.doris.common.UserException; +import org.apache.doris.qe.ShowResultSetMetaData; + +import com.google.common.collect.ImmutableList; + +import java.util.List; + +/** + * ShowAnalyzeTabletsStmt is used to show statistics of tablets info. + * syntax: + * SHOW ANALYZE TABLETS tablet_ids + */ +public class ShowAnalyzeTabletsStmt extends ShowStmt { + private List tabletIds; + + private static final ImmutableList TITLE_NAMES = new ImmutableList.Builder() + .add("DbName") + .add("TableName") + .add("TableSize") + .add("PartitionNum") + .add("BucketNum") + .add("ReplicaCount") + .add("TabletIds") + .build(); + + public ShowAnalyzeTabletsStmt(List tabletIds) { + this.tabletIds = tabletIds; + } + + public List getTabletIds() { + return tabletIds; + } + + @Override + public void analyze(Analyzer analyzer) throws UserException { + if (tabletIds == null || tabletIds.isEmpty()) { + throw new UserException("Please supply at least one tablet id"); + } + } + + @Override + public ShowResultSetMetaData getMetaData() { + ShowResultSetMetaData.Builder builder = ShowResultSetMetaData.builder(); + for (String title : TITLE_NAMES) { + builder.addColumn(new Column(title, ScalarType.createVarchar(128))); + } + return builder.build(); + } + + @Override + public RedirectStatus getRedirectStatus() { + return RedirectStatus.FORWARD_NO_SYNC; + } + + @Override + public String toSql() { + StringBuilder sb = new StringBuilder(); + sb.append("SHOW ANALYZE TABLETS "); + + for (long tabletId : tabletIds) { + sb.append(tabletId); + sb.append(", "); + } + + String tmp = sb.toString(); + return tmp.substring(tmp.length() - 1); + } + + @Override + public String toString() { + return toSql(); + } +} 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 430f790ecd3768..96709bee1f85dc 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 @@ -29,6 +29,7 @@ import org.apache.doris.analysis.PartitionNames; import org.apache.doris.analysis.ShowAlterStmt; import org.apache.doris.analysis.ShowAnalyzeStmt; +import org.apache.doris.analysis.ShowAnalyzeTabletsStmt; import org.apache.doris.analysis.ShowAnalyzeTaskStatus; import org.apache.doris.analysis.ShowAuthorStmt; import org.apache.doris.analysis.ShowBackendsStmt; @@ -168,6 +169,7 @@ import org.apache.doris.common.proc.TrashProcNode; import org.apache.doris.common.profile.ProfileTreeNode; import org.apache.doris.common.profile.ProfileTreePrinter; +import org.apache.doris.common.util.DebugUtil; import org.apache.doris.common.util.ListComparator; import org.apache.doris.common.util.LogBuilder; import org.apache.doris.common.util.LogKey; @@ -237,6 +239,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -417,6 +420,8 @@ public ShowResultSet execute() throws AnalysisException { handleShowCreateCatalog(); } else if (stmt instanceof ShowAnalyzeStmt) { handleShowAnalyze(); + } else if (stmt instanceof ShowAnalyzeTabletsStmt) { + handleShowAnalyzeTablet(); } else if (stmt instanceof AdminCopyTabletStmt) { handleCopyTablet(); } else if (stmt instanceof ShowCatalogRecycleBinStmt) { @@ -2704,6 +2709,62 @@ private void handleShowAnalyze() { resultSet = new ShowResultSet(showStmt.getMetaData(), resultRows); } + private void handleShowAnalyzeTablet() { + ShowAnalyzeTabletsStmt showStmt = (ShowAnalyzeTabletsStmt) stmt; + List> rows = new ArrayList<>(); + + Env env = Env.getCurrentEnv(); + + TabletInvertedIndex invertedIndex = Env.getCurrentInvertedIndex(); + Map> tableToTabletIdsMap = new HashMap<>(); + for (long tabletId : showStmt.getTabletIds()) { + TabletMeta tabletMeta = invertedIndex.getTabletMeta(tabletId); + if (tabletMeta == null) { + continue; + } + Database db = env.getInternalCatalog().getDbNullable(tabletMeta.getDbId()); + if (db == null) { + continue; + } + long tableId = tabletMeta.getTableId(); + Table table = db.getTableNullable(tableId); + if (table == null) { + continue; + } + + if (!tableToTabletIdsMap.containsKey(tableId)) { + tableToTabletIdsMap.put(tableId, new HashSet<>()); + } + tableToTabletIdsMap.get(tableId).add(tabletId); + } + + for (long tableId : tableToTabletIdsMap.keySet()) { + Table table = env.getInternalCatalog().getTableByTableId(tableId); + List line = new ArrayList<>(); + line.add(table.getDatabase().getFullName()); + line.add(table.getName()); + + OlapTable olapTable = (OlapTable) table; + Pair tableSizePair = DebugUtil.getByteUint((long) olapTable.getDataSize()); + String readableSize = DebugUtil.DECIMAL_FORMAT_SCALE_3.format(tableSizePair.first) + " " + + tableSizePair.second; + line.add(readableSize); + line.add(new Long(olapTable.getPartitionNum()).toString()); + int totalBucketNum = 0; + Set partitionNamesSet = table.getPartitionNames(); + for (String partitionName : partitionNamesSet) { + totalBucketNum += table.getPartition(partitionName).getDistributionInfo().getBucketNum(); + } + line.add(new Long(totalBucketNum).toString()); + line.add(new Long(olapTable.getReplicaCount()).toString()); + line.add(tableToTabletIdsMap.get(tableId).toString()); + + rows.add(line); + } + + resultSet = new ShowResultSet(showStmt.getMetaData(), rows); + } + private void handleCopyTablet() throws AnalysisException { AdminCopyTabletStmt copyStmt = (AdminCopyTabletStmt) stmt; long tabletId = copyStmt.getTabletId(); From 91c3121ba00e535aff8618c12f7079075a63448c Mon Sep 17 00:00:00 2001 From: Yulei-Yang Date: Tue, 5 Dec 2023 20:55:33 +0800 Subject: [PATCH 2/3] rename stmt --- ...W-ANALYZE-TABLETS.md => SHOW-TABLETS-BELONG.md} | 12 ++++++------ docs/sidebars.json | 2 +- ...W-ANALYZE-TABLETS.md => SHOW-TABLETS-BELONG.md} | 14 +++++++------- fe/fe-core/src/main/cup/sql_parser.cup | 9 +++++---- ...TabletsStmt.java => ShowTabletsBelongStmt.java} | 10 +++++----- .../java/org/apache/doris/qe/ShowExecutor.java | 6 +++--- fe/fe-core/src/main/jflex/sql_scanner.flex | 1 + 7 files changed, 28 insertions(+), 26 deletions(-) rename docs/en/docs/sql-manual/sql-reference/Show-Statements/{SHOW-ANALYZE-TABLETS.md => SHOW-TABLETS-BELONG.md} (90%) rename docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/{SHOW-ANALYZE-TABLETS.md => SHOW-TABLETS-BELONG.md} (86%) rename fe/fe-core/src/main/java/org/apache/doris/analysis/{ShowAnalyzeTabletsStmt.java => ShowTabletsBelongStmt.java} (90%) diff --git a/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md similarity index 90% rename from docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md rename to docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md index f271e80bd0cf14..9321c90ff516fd 100644 --- a/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md +++ b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md @@ -1,6 +1,6 @@ --- { - "title": "SHOW-ANALYZE-TABLETS", + "title": "SHOW-TABLETS-BELONG", "language": "en" } --- @@ -26,13 +26,13 @@ under the License. -## SHOW-ANALYZE-TABLETS +## SHOW-TABLETS-BELONG ### Name -SHOW ANALYZE TABLETS +SHOW TABLETS BELONG ### Description @@ -41,7 +41,7 @@ Used to show tablets and information of their belonging table grammar: ```sql -SHOW ANALYZE TABLETS tablet-ids; +SHOW TABLETS BELONG tablet-ids; ``` illustrate: @@ -54,7 +54,7 @@ illustrate: 1. show information of four tablet-ids (actually, three tablet-ids. Result will be deduplicated) ```sql - SHOW ANALYZE TABLETS 27028,78880,78382,27028; + SHOW TABLETS BELONG 27028,78880,78382,27028; ``` ``` @@ -68,7 +68,7 @@ illustrate: ### Keywords - SHOW, ANALYZE, TABLETS + SHOW, TABLETS, BELONG ### Best Practice diff --git a/docs/sidebars.json b/docs/sidebars.json index d216c95b8104ca..f81e84b71c2b40 100644 --- a/docs/sidebars.json +++ b/docs/sidebars.json @@ -1025,7 +1025,6 @@ "type": "category", "label": "Show", "items": [ - "sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS", "sql-manual/sql-reference/Show-Statements/SHOW-ALTER-TABLE-MATERIALIZED-VIEW", "sql-manual/sql-reference/Show-Statements/SHOW-ALTER", "sql-manual/sql-reference/Show-Statements/SHOW-BACKUP", @@ -1070,6 +1069,7 @@ "sql-manual/sql-reference/Show-Statements/SHOW-WHITE-LIST", "sql-manual/sql-reference/Show-Statements/SHOW-WARNING", "sql-manual/sql-reference/Show-Statements/SHOW-TABLET", + "sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG", "sql-manual/sql-reference/Show-Statements/SHOW-VARIABLES", "sql-manual/sql-reference/Show-Statements/SHOW-PLUGINS", "sql-manual/sql-reference/Show-Statements/SHOW-ROLES", diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md similarity index 86% rename from docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md rename to docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md index 1b80fbd464b19d..492659634681ec 100644 --- a/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-ANALYZE-TABLETS.md +++ b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-TABLETS-BELONG.md @@ -1,6 +1,6 @@ --- { - "title": "SHOW-ANALYZE-TABLETS", + "title": "SHOW-TABLETS-BELONG", "language": "zh-CN" } --- @@ -26,13 +26,13 @@ under the License. -## SHOW-ANALYZE-TABLETS +## SHOW-TABLETS-BELONG ### Name -SHOW ANALYZE TABLETS +SHOW TABLETS BELONG ### Description @@ -41,12 +41,12 @@ SHOW ANALYZE TABLETS 语法: ```sql -SHOW ANALYZE TABLETS tablet-ids; +SHOW TABLETS BELONG tablet-ids; ``` 说明: -1. tablet-ids:指一到多个tablet-id构成的列表。如有多个,使用逗号分隔 +1. tablet-ids:代表一到多个tablet-id构成的列表。如有多个,使用逗号分隔 2. 结果中 table 相关的信息和 `SHOW-DATA` 语句的口径一致 ### Example @@ -54,7 +54,7 @@ SHOW ANALYZE TABLETS tablet-ids; 1. 展示3个tablet-id的相关信息(tablet-id可去重) ```sql - SHOW ANALYZE TABLETS 27028,78880,78382,27028; + SHOW TABLETS BELONG 27028,78880,78382,27028; ``` ``` @@ -68,7 +68,7 @@ SHOW ANALYZE TABLETS tablet-ids; ### Keywords - SHOW, ANALYZE, TABLETS + SHOW, TABLETS, BELONG ### Best Practice diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup index c3833ace11888e..47fa87dc4e4af0 100644 --- a/fe/fe-core/src/main/cup/sql_parser.cup +++ b/fe/fe-core/src/main/cup/sql_parser.cup @@ -267,6 +267,7 @@ terminal String KW_BACKENDS, KW_BACKUP, KW_BEGIN, + KW_BELONG, KW_BETWEEN, KW_BIGINT, KW_BIN, @@ -3981,6 +3982,10 @@ show_param ::= {: RESULT = new ShowTabletStmt(null, tabletId); :} + | KW_TABLETS KW_BELONG integer_list:tabletIds + {: + RESULT = new ShowTabletsBelongStmt(tabletIds); + :} | KW_TABLETS KW_FROM table_name:dbTblName opt_partition_names:partitionNames opt_wild_where order_by_clause:orderByClause limit_clause:limitClause {: RESULT = new ShowTabletStmt(dbTblName, -1L, partitionNames, parser.where, orderByClause, limitClause); @@ -4152,10 +4157,6 @@ show_param ::= {: RESULT = new ShowAnalyzeTaskStatus(jobId); :} - | KW_ANALYZE KW_TABLETS integer_list:tabletIds - {: - RESULT = new ShowAnalyzeTabletsStmt(tabletIds); - :} | KW_CATALOG KW_RECYCLE KW_BIN opt_wild_where {: RESULT = new ShowCatalogRecycleBinStmt(parser.where); diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowTabletsBelongStmt.java similarity index 90% rename from fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java rename to fe/fe-core/src/main/java/org/apache/doris/analysis/ShowTabletsBelongStmt.java index bf5d41c724e8a8..b321dace7f555e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowAnalyzeTabletsStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowTabletsBelongStmt.java @@ -27,11 +27,11 @@ import java.util.List; /** - * ShowAnalyzeTabletsStmt is used to show statistics of tablets info. + * ShowTabletsBelongStmt is used to show information of tables which tablets are belonged to * syntax: - * SHOW ANALYZE TABLETS tablet_ids + * SHOW TABLETS BELONG tablet_ids */ -public class ShowAnalyzeTabletsStmt extends ShowStmt { +public class ShowTabletsBelongStmt extends ShowStmt { private List tabletIds; private static final ImmutableList TITLE_NAMES = new ImmutableList.Builder() @@ -44,7 +44,7 @@ public class ShowAnalyzeTabletsStmt extends ShowStmt { .add("TabletIds") .build(); - public ShowAnalyzeTabletsStmt(List tabletIds) { + public ShowTabletsBelongStmt(List tabletIds) { this.tabletIds = tabletIds; } @@ -76,7 +76,7 @@ public RedirectStatus getRedirectStatus() { @Override public String toSql() { StringBuilder sb = new StringBuilder(); - sb.append("SHOW ANALYZE TABLETS "); + sb.append("SHOW TABLETS BELONG "); for (long tabletId : tabletIds) { sb.append(tabletId); 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 96709bee1f85dc..8780bd9360c813 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 @@ -29,7 +29,6 @@ import org.apache.doris.analysis.PartitionNames; import org.apache.doris.analysis.ShowAlterStmt; import org.apache.doris.analysis.ShowAnalyzeStmt; -import org.apache.doris.analysis.ShowAnalyzeTabletsStmt; import org.apache.doris.analysis.ShowAnalyzeTaskStatus; import org.apache.doris.analysis.ShowAuthorStmt; import org.apache.doris.analysis.ShowBackendsStmt; @@ -98,6 +97,7 @@ import org.apache.doris.analysis.ShowTableStatusStmt; import org.apache.doris.analysis.ShowTableStmt; import org.apache.doris.analysis.ShowTabletStmt; +import org.apache.doris.analysis.ShowTabletsBelongStmt; import org.apache.doris.analysis.ShowTransactionStmt; import org.apache.doris.analysis.ShowTrashDiskStmt; import org.apache.doris.analysis.ShowTrashStmt; @@ -420,7 +420,7 @@ public ShowResultSet execute() throws AnalysisException { handleShowCreateCatalog(); } else if (stmt instanceof ShowAnalyzeStmt) { handleShowAnalyze(); - } else if (stmt instanceof ShowAnalyzeTabletsStmt) { + } else if (stmt instanceof ShowTabletsBelongStmt) { handleShowAnalyzeTablet(); } else if (stmt instanceof AdminCopyTabletStmt) { handleCopyTablet(); @@ -2710,7 +2710,7 @@ private void handleShowAnalyze() { } private void handleShowAnalyzeTablet() { - ShowAnalyzeTabletsStmt showStmt = (ShowAnalyzeTabletsStmt) stmt; + ShowTabletsBelongStmt showStmt = (ShowTabletsBelongStmt) stmt; List> rows = new ArrayList<>(); Env env = Env.getCurrentEnv(); diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex b/fe/fe-core/src/main/jflex/sql_scanner.flex index 7ad9845701c813..ad98eacef2eebe 100644 --- a/fe/fe-core/src/main/jflex/sql_scanner.flex +++ b/fe/fe-core/src/main/jflex/sql_scanner.flex @@ -115,6 +115,7 @@ import org.apache.doris.qe.SqlModeHelper; keywordMap.put("backends", new Integer(SqlParserSymbols.KW_BACKENDS)); keywordMap.put("backup", new Integer(SqlParserSymbols.KW_BACKUP)); keywordMap.put("begin", new Integer(SqlParserSymbols.KW_BEGIN)); + keywordMap.put("belong", new Integer(SqlParserSymbols.KW_BELONG)); keywordMap.put("between", new Integer(SqlParserSymbols.KW_BETWEEN)); keywordMap.put("bigint", new Integer(SqlParserSymbols.KW_BIGINT)); keywordMap.put("bin", new Integer(SqlParserSymbols.KW_BIN)); From d077f95876a9d4784f89ff431c702f0447199c7c Mon Sep 17 00:00:00 2001 From: Yulei-Yang Date: Wed, 6 Dec 2023 11:56:06 +0800 Subject: [PATCH 3/3] update --- .../src/main/java/org/apache/doris/qe/ShowExecutor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8780bd9360c813..4b6679299f164e 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 @@ -421,7 +421,7 @@ public ShowResultSet execute() throws AnalysisException { } else if (stmt instanceof ShowAnalyzeStmt) { handleShowAnalyze(); } else if (stmt instanceof ShowTabletsBelongStmt) { - handleShowAnalyzeTablet(); + handleShowTabletsBelong(); } else if (stmt instanceof AdminCopyTabletStmt) { handleCopyTablet(); } else if (stmt instanceof ShowCatalogRecycleBinStmt) { @@ -2709,7 +2709,7 @@ private void handleShowAnalyze() { resultSet = new ShowResultSet(showStmt.getMetaData(), resultRows); } - private void handleShowAnalyzeTablet() { + private void handleShowTabletsBelong() { ShowTabletsBelongStmt showStmt = (ShowTabletsBelongStmt) stmt; List> rows = new ArrayList<>();