This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/dev-1.0.1 by this push:
new aa86a7b68e [cherry-pick] Some missing file for #9037
aa86a7b68e is described below
commit aa86a7b68ef5ad4d72ee94320d9cbe593771f1b3
Author: morningman <[email protected]>
AuthorDate: Thu Apr 28 10:35:03 2022 +0800
[cherry-pick] Some missing file for #9037
---
.../ADMIN SHOW TABLET STORAGE FORMAT.md | 53 ++++++++++++++
.../ADMIN SHOW TABLET STORAGE FORMAT.md | 53 ++++++++++++++
.../analysis/AdminShowTabletStorageFormatStmt.java | 83 ++++++++++++++++++++++
3 files changed, 189 insertions(+)
diff --git a/docs/en/sql-reference/sql-statements/Administration/ADMIN SHOW
TABLET STORAGE FORMAT.md
b/docs/en/sql-reference/sql-statements/Administration/ADMIN SHOW TABLET STORAGE
FORMAT.md
new file mode 100644
index 0000000000..06692f0878
--- /dev/null
+++ b/docs/en/sql-reference/sql-statements/Administration/ADMIN SHOW TABLET
STORAGE FORMAT.md
@@ -0,0 +1,53 @@
+---
+{
+ "title": "ADMIN SHOW TABLET STORAGE FORMAT",
+ "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.
+-->
+
+# ADMIN SHOW TABLET STORAGE FORMAT
+## description
+ This statement is used to display tablet storage foramt information (for
administrators only)
+ Grammar:
+ ADMIN SHOW TABLET STORAGE FORMAT [VERBOSE]
+
+## example
+ MySQL [(none)]> admin show tablet storage format;
+ +-----------+---------+---------+
+ | BackendId | V1Count | V2Count |
+ +-----------+---------+---------+
+ | 10002 | 0 | 2867 |
+ +-----------+---------+---------+
+ 1 row in set (0.003 sec)
+ MySQL [test_query_qa]> admin show tablet storage format verbose;
+ +-----------+----------+---------------+
+ | BackendId | TabletId | StorageFormat |
+ +-----------+----------+---------------+
+ | 10002 | 39227 | V2 |
+ | 10002 | 39221 | V2 |
+ | 10002 | 39215 | V2 |
+ | 10002 | 39199 | V2 |
+ +-----------+----------+---------------+
+ 4 rows in set (0.034 sec)
+## keyword
+ ADMIN,SHOW,TABLET,STORAGE,FORMAT
+
diff --git a/docs/zh-CN/sql-reference/sql-statements/Administration/ADMIN SHOW
TABLET STORAGE FORMAT.md
b/docs/zh-CN/sql-reference/sql-statements/Administration/ADMIN SHOW TABLET
STORAGE FORMAT.md
new file mode 100644
index 0000000000..c7ff344012
--- /dev/null
+++ b/docs/zh-CN/sql-reference/sql-statements/Administration/ADMIN SHOW TABLET
STORAGE FORMAT.md
@@ -0,0 +1,53 @@
+---
+{
+ "title": "ADMIN SHOW TABLET STORAGE FORMAT",
+ "language": "zh-CN"
+}
+---
+
+<!--
+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.
+-->
+
+# ADMIN SHOW TABLET STORAGE FORMAT
+## description
+ 该语句用于显示Backend上的存储格式信息(仅管理员使用)
+ 语法:
+ ADMIN SHOW TABLET STORAGE FORMAT [VERBOSE]
+
+## example
+ MySQL [(none)]> admin show tablet storage format;
+ +-----------+---------+---------+
+ | BackendId | V1Count | V2Count |
+ +-----------+---------+---------+
+ | 10002 | 0 | 2867 |
+ +-----------+---------+---------+
+ 1 row in set (0.003 sec)
+ MySQL [test_query_qa]> admin show tablet storage format verbose;
+ +-----------+----------+---------------+
+ | BackendId | TabletId | StorageFormat |
+ +-----------+----------+---------------+
+ | 10002 | 39227 | V2 |
+ | 10002 | 39221 | V2 |
+ | 10002 | 39215 | V2 |
+ | 10002 | 39199 | V2 |
+ +-----------+----------+---------------+
+ 4 rows in set (0.034 sec)
+## keyword
+ ADMIN,SHOW,TABLET,STORAGE,FORMAT
+
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminShowTabletStorageFormatStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminShowTabletStorageFormatStmt.java
new file mode 100644
index 0000000000..975731a5fd
--- /dev/null
+++
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminShowTabletStorageFormatStmt.java
@@ -0,0 +1,83 @@
+// 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.Catalog;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+public class AdminShowTabletStorageFormatStmt extends ShowStmt {
+ private boolean verbose;
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ public AdminShowTabletStorageFormatStmt(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ @Override
+ public void analyze(Analyzer analyzer) throws UserException {
+ // check access first
+ if
(!Catalog.getCurrentCatalog().getAuth().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
+
ErrorReport.reportAnalysisException(ErrorCode.ERR_ACCESS_DENIED_ERROR,
+ toSql(),
+ ConnectContext.get().getQualifiedUser(),
+ ConnectContext.get().getRemoteIP(), "ADMIN Privilege
needed.");
+ }
+
+ super.analyze(analyzer);
+ }
+
+ @Override
+ public String toSql() {
+ StringBuilder sb = new StringBuilder("ADMIN SHOW TABLET STORAGE TYPE");
+ if (verbose) {
+ sb.append(" VERBOSE");
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String toString() {
+ return toSql();
+ }
+
+ @Override
+ public ShowResultSetMetaData getMetaData() {
+ ShowResultSetMetaData.Builder builder =
ShowResultSetMetaData.builder();
+ if (verbose) {
+ builder.addColumn(new Column("BackendId",
ScalarType.createVarchar(30)))
+ .addColumn(new Column("TabletId",
ScalarType.createVarchar(30)))
+ .addColumn(new Column("StorageFormat",
ScalarType.createVarchar(30)));
+ } else {
+ builder.addColumn(new Column("BackendId",
ScalarType.createVarchar(30)))
+ .addColumn(new Column("V1Count",
ScalarType.createVarchar(30)))
+ .addColumn(new Column("V2Count",
ScalarType.createVarchar(30)));
+ }
+ return builder.build();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]