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

morningman pushed a commit to branch dev-1.0.0
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit d2b88edfdab7179f580e587c85007e27f7818cf1
Author: ChPi <chji...@gmail.com>
AuthorDate: Sat Mar 5 15:25:57 2022 +0800

    [improvement] Support show tablets stmt (#7970)
    
    change `show tablet from tbl` to `show tablets from tbl`
---
 .../Data Manipulation/SHOW TABLET.md               | 13 ++---
 .../Data Manipulation/SHOW TABLETS.md              | 56 ++++++++++++++++++++++
 .../Data Manipulation/SHOW TABLET.md               | 33 ++-----------
 .../{SHOW TABLET.md => SHOW TABLETS.md}            | 46 +++++++++---------
 fe/fe-core/src/main/cup/sql_parser.cup             |  4 +-
 fe/fe-core/src/main/jflex/sql_scanner.flex         |  1 +
 6 files changed, 89 insertions(+), 64 deletions(-)

diff --git a/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md b/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md
index 17a559e..21ccbcc 100644
--- a/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW TABLET.md     
+++ b/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW TABLET.md     
@@ -26,17 +26,14 @@ under the License.
 
 # SHOW TABLET
 ## Description
-This statement is used to display tablet-related information (for 
administrators only)
-Grammar:
-SHOW TABLET
-[From [db-uu name]] table U name.; Table U Id]
+    This statement is used to display information of the specified tablet (for 
administrators only)
+    Grammar:
+        SHOW TABLET tablet_id
 
 ## example
-1. Display all tablet information in the specified table below the specified DB
-SHOW TABLET FROM example_db.table_name;
 
-2. Display parent level ID information of tablet with specified tablet ID of 
10000
-Performance board 10000;
+        // Display parent level ID information of tablet with specified tablet 
id of 10000
+        SHOW TABLET 10000;
 
 ## keyword
 SHOW,TABLET
diff --git a/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLETS.md b/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLETS.md
new file mode 100644
index 0000000..0ed338d
--- /dev/null
+++ b/docs/en/sql-reference/sql-statements/Data Manipulation/SHOW TABLETS.md    
@@ -0,0 +1,56 @@
+---
+{
+    "title": "SHOW TABLETS",
+    "language": "en"
+}
+---
+
+<!-- 
+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.
+-->
+
+# SHOW TABLETS
+## Description
+    This statement is used to display tablet-related information (for 
administrators only)
+    Grammar:
+        SHOW TABLETS
+        [FROM [db_name.]table_name] [partiton(partition_name_1, 
partition_name_1)]
+        [where [version=1] [and backendid=10000] [and 
state="NORMAL|ROLLUP|CLONE|DECOMMISSION"]]
+        [order by order_column]
+        [limit [offset,]size]
+
+## example
+        // Display all tablets information in the specified table below the 
specified DB
+        SHOW TABLETS FROM example_db.table_name;
+        
+        SHOW TABLETS FROM example_db.table_name partition(p1, p2);
+        
+        // display 10 tablets information in the table
+        SHOW TABLETS FROM example_db.table_name limit 10;
+        
+        SHOW TABLETS FROM example_db.table_name limit 5,10;
+        
+        // display the tablets that fulfill some conditions
+        SHOW TABLETS FROM example_db.table_name where backendid=10000 and 
version=1 and state="NORMAL";
+        
+        SHOW TABLETS FROM example_db.table_name where backendid=10000 order by 
version;
+    
+        SHOW TABLETS FROM example_db.table_name where indexname="t1_rollup";
+
+## keyword
+    SHOW,TABLETS,LIMIT
diff --git a/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md b/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md
index fc6fb77..d2de94f 100644
--- a/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW TABLET.md  
+++ b/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW TABLET.md  
@@ -26,40 +26,13 @@ under the License.
 
 # SHOW TABLET
 ## description
-    该语句用于显示 tablet 相关的信息(仅管理员使用)
+    该语句用于显示指定tablet id 信息(仅管理员使用)
     语法:
-        SHOW TABLET
-        [FROM [db_name.]table_name | tablet_id] [partiton(partition_name_1, 
partition_name_1)]
-        [where [version=1] [and backendid=10000] [and 
state="NORMAL|ROLLUP|CLONE|DECOMMISSION"]]
-        [order by order_column]
-        [limit [offset,]size]
+        SHOW TABLET tablet_id
 
-    现在show tablet命令支持按照按照以下字段进行过滤:partition, index name, version, backendid,
-    state,同时支持按照任意字段进行排序,并且提供limit限制返回条数。
 
 ## example
-    1. 显示指定 db 的下指定表所有 tablet 信息
-        SHOW TABLET FROM example_db.table_name;
-
-        // 获取partition p1和p2的tablet信息
-        SHOW TABLET FROM example_db.table_name partition(p1, p2);
-
-        // 获取10个结果
-        SHOW TABLET FROM example_db.table_name limit 10;
-
-        // 从偏移5开始获取10个结果
-        SHOW TABLET FROM example_db.table_name limit 5,10;
-
-        // 按照backendid/version/state字段进行过滤
-        SHOW TABLET FROM example_db.table_name where backendid=10000 and 
version=1 and state="NORMAL";
-
-        // 按照version字段进行排序
-        SHOW TABLET FROM example_db.table_name where backendid=10000 order by 
version;
-
-        // 获取index名字为t1_rollup的tablet相关信息
-        SHOW TABLET FROM example_db.table_name where indexname="t1_rollup";
-        
-    2. 显示指定 tablet id 为 10000 的 tablet 的父层级 id 信息
+        // 显示指定 tablet id 为 10000 的 tablet 的父层级 id 信息
         SHOW TABLET 10000;
 
 ## keyword
diff --git a/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md b/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLETS.md
similarity index 60%
copy from docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLET.md
copy to docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW 
TABLETS.md
index fc6fb77..113a69e 100644
--- a/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW TABLET.md  
+++ b/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW TABLETS.md 
@@ -1,6 +1,6 @@
 ---
 {
-    "title": "SHOW TABLET",
+    "title": "SHOW TABLETS",
     "language": "zh-CN"
 }
 ---
@@ -24,44 +24,42 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-# SHOW TABLET
+# SHOW TABLETS
 ## description
     该语句用于显示 tablet 相关的信息(仅管理员使用)
     语法:
-        SHOW TABLET
-        [FROM [db_name.]table_name | tablet_id] [partiton(partition_name_1, 
partition_name_1)]
+        SHOW TABLETS
+        [FROM [db_name.]table_name] [partiton(partition_name_1, 
partition_name_1)]
         [where [version=1] [and backendid=10000] [and 
state="NORMAL|ROLLUP|CLONE|DECOMMISSION"]]
         [order by order_column]
         [limit [offset,]size]
-
-    现在show tablet命令支持按照按照以下字段进行过滤:partition, index name, version, backendid,
+    
+    现在show tablets命令支持按照按照以下字段进行过滤:partition, index name, version, backendid,
     state,同时支持按照任意字段进行排序,并且提供limit限制返回条数。
 
 ## example
-    1. 显示指定 db 的下指定表所有 tablet 信息
-        SHOW TABLET FROM example_db.table_name;
-
+        // 显示指定 db 的下指定表所有 tablet 信息
+        SHOW TABLETS FROM example_db.table_name;
+    
         // 获取partition p1和p2的tablet信息
-        SHOW TABLET FROM example_db.table_name partition(p1, p2);
-
+        SHOW TABLETS FROM example_db.table_name partition(p1, p2);
+    
         // 获取10个结果
-        SHOW TABLET FROM example_db.table_name limit 10;
-
+        SHOW TABLETS FROM example_db.table_name limit 10;
+    
         // 从偏移5开始获取10个结果
-        SHOW TABLET FROM example_db.table_name limit 5,10;
-
+        SHOW TABLETS FROM example_db.table_name limit 5,10;
+    
         // 按照backendid/version/state字段进行过滤
-        SHOW TABLET FROM example_db.table_name where backendid=10000 and 
version=1 and state="NORMAL";
-
+        SHOW TABLETS FROM example_db.table_name where backendid=10000 and 
version=1 and state="NORMAL";
+    
         // 按照version字段进行排序
-        SHOW TABLET FROM example_db.table_name where backendid=10000 order by 
version;
-
+        SHOW TABLETS FROM example_db.table_name where backendid=10000 order by 
version;
+    
         // 获取index名字为t1_rollup的tablet相关信息
-        SHOW TABLET FROM example_db.table_name where indexname="t1_rollup";
-        
-    2. 显示指定 tablet id 为 10000 的 tablet 的父层级 id 信息
-        SHOW TABLET 10000;
+        SHOW TABLETS FROM example_db.table_name where indexname="t1_rollup";
+
 
 ## keyword
-    SHOW,TABLET,LIMIT
+    SHOW,TABLETS,LIMIT
 
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 5a9953c..3f1a01e 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -267,7 +267,7 @@ terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, 
KW_ALIAS, KW_ALL, KW_A
     KW_SKEW,
     KW_SMALLINT, KW_SNAPSHOT, KW_SONAME, KW_SPLIT, KW_START, KW_STATUS, 
KW_STATS, KW_STOP, KW_STORAGE, KW_STREAM, KW_STRING, KW_STRUCT,
     KW_SUM, KW_SUPERUSER, KW_SYNC, KW_SYSTEM,
-    KW_TABLE, KW_TABLES, KW_TABLET, KW_TASK, KW_TEMPORARY, KW_TERMINATED, 
KW_TEXT, KW_THAN, KW_TIME, KW_THEN, KW_TIMESTAMP, KW_TINYINT,KW_TRASH,
+    KW_TABLE, KW_TABLES, KW_TABLET, KW_TABLETS, KW_TASK, KW_TEMPORARY, 
KW_TERMINATED, KW_TEXT, KW_THAN, KW_TIME, KW_THEN, KW_TIMESTAMP, 
KW_TINYINT,KW_TRASH,
     KW_TO, KW_TRANSACTION, KW_TRIGGERS, KW_TRIM, KW_TRUE, KW_TRUNCATE, 
KW_TYPE, KW_TYPES,
     KW_UNCOMMITTED, KW_UNBOUNDED, KW_UNION, KW_UNIQUE, KW_UNLOCK, KW_UNSIGNED, 
KW_USE, KW_USER, KW_USING, KW_UNINSTALL,
     KW_VALUE, KW_VALUES, KW_VARCHAR, KW_VARIABLES, KW_VERBOSE, KW_VIEW,
@@ -2756,7 +2756,7 @@ show_param ::=
     {:
         RESULT = new ShowTabletStmt(null, tabletId);
     :}
-    | KW_TABLET KW_FROM table_name:dbTblName 
opt_partition_names:partitionNames opt_wild_where order_by_clause:orderByClause 
limit_clause:limitClause
+    | 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);
     :}
diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex 
b/fe/fe-core/src/main/jflex/sql_scanner.flex
index 86ccd72..6f35656 100644
--- a/fe/fe-core/src/main/jflex/sql_scanner.flex
+++ b/fe/fe-core/src/main/jflex/sql_scanner.flex
@@ -421,6 +421,7 @@ import org.apache.doris.qe.SqlModeHelper;
         keywordMap.put("year", new Integer(SqlParserSymbols.KW_YEAR));
         keywordMap.put("||", new Integer(SqlParserSymbols.KW_PIPE));
         keywordMap.put("sql_block_rule", new 
Integer(SqlParserSymbols.KW_SQL_BLOCK_RULE));
+        keywordMap.put("tablets", new Integer(SqlParserSymbols.KW_TABLETS));
    }
     
   // map from token id to token description

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

Reply via email to