diff --git a/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
index 29e24ad888..86aad62cb1 100644
--- a/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
+++ b/docs/en/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
@@ -37,13 +37,19 @@ This statement is used to display the creation statement of the data table.
grammar:
```sql
-SHOW CREATE TABLE [DBNAME.]TABLE_NAME
+SHOW [BRIEF] CREATE TABLE [DBNAME.]TABLE_NAME
````
illustrate:
-1. `DBNAMNE` : database name
-2. `TABLE_NAME` : table name
+
+
+1. `BRIEF` : will not show partitions info
+
+
+
+2. `DBNAMNE` : database name
+3. `TABLE_NAME` : table name
### Example
diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
index 0f69fe4215..77c5eb514e 100644
--- a/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
+++ b/docs/zh-CN/docs/sql-manual/sql-reference/Show-Statements/SHOW-CREATE-TABLE.md
@@ -37,13 +37,19 @@ SHOW CREATE TABLE
语法:
```sql
-SHOW CREATE TABLE [DBNAME.]TABLE_NAME
+SHOW [BRIEF] CREATE TABLE [DBNAME.]TABLE_NAME
```
说明:
-1. `DBNAMNE` : 数据库名称
-2. `TABLE_NAME` : 表名
+
+
+1. `BRIEF` : 返回结果中不展示分区信息
+
+
+
+2. `DBNAMNE` : 数据库名称
+3. `TABLE_NAME` : 表名
### Example
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup b/fe/fe-core/src/main/cup/sql_parser.cup
index 5ad3937ad7..103815ace7 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -271,6 +271,7 @@ terminal String
KW_NGRAM_BF,
KW_BLOB,
KW_BOOLEAN,
+ KW_BRIEF,
KW_BROKER,
KW_BUCKETS,
KW_BUILD,
@@ -3716,10 +3717,14 @@ show_param ::=
{:
RESULT = new ShowCreateTableStmt(table);
:}
- | KW_CREATE KW_VIEW table_name:table
+ | KW_BRIEF KW_CREATE KW_TABLE table_name:table
{:
RESULT = new ShowCreateTableStmt(table, true);
:}
+ | KW_CREATE KW_VIEW table_name:table
+ {:
+ RESULT = new ShowCreateTableStmt(table, true, false);
+ :}
/* Create database */
| KW_CREATE KW_DATABASE ident:db
{:
@@ -7103,6 +7108,8 @@ keyword ::=
{: RESULT = id; :}
| KW_BOOLEAN:id
{: RESULT = id; :}
+ | KW_BRIEF:id
+ {: RESULT = id; :}
| KW_BROKER:id
{: RESULT = id; :}
| KW_S3:id
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateTableStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateTableStmt.java
index 4b8ed8f5d8..9527a061d3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateTableStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ShowCreateTableStmt.java
@@ -51,14 +51,20 @@ public class ShowCreateTableStmt extends ShowStmt {
private TableName tbl;
private boolean isView;
+ private boolean needBriefDdl;
public ShowCreateTableStmt(TableName tbl) {
- this(tbl, false);
+ this(tbl, false, false);
}
- public ShowCreateTableStmt(TableName tbl, boolean isView) {
+ public ShowCreateTableStmt(TableName tbl, boolean needBriefDdl) {
+ this(tbl, false, needBriefDdl);
+ }
+
+ public ShowCreateTableStmt(TableName tbl, boolean isView, boolean needBriefDdl) {
this.tbl = tbl;
this.isView = isView;
+ this.needBriefDdl = needBriefDdl;
}
@@ -78,6 +84,10 @@ public class ShowCreateTableStmt extends ShowStmt {
return isView;
}
+ public boolean isNeedBriefDdl() {
+ return needBriefDdl;
+ }
+
public static ShowResultSetMetaData getViewMetaData() {
return VIEW_META_DATA;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index dad70edd20..79915a0d6c 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -2766,7 +2766,7 @@ public class Env {
public static void getDdlStmt(TableIf table, List createTableStmt, List addPartitionStmt,
List createRollupStmt, boolean separatePartition, boolean hidePassword, long specificVersion) {
getDdlStmt(null, null, table, createTableStmt, addPartitionStmt, createRollupStmt, separatePartition,
- hidePassword, false, specificVersion);
+ hidePassword, false, specificVersion, false);
}
/**
@@ -2776,7 +2776,7 @@ public class Env {
*/
public static void getDdlStmt(DdlStmt ddlStmt, String dbName, TableIf table, List createTableStmt,
List addPartitionStmt, List createRollupStmt, boolean separatePartition,
- boolean hidePassword, boolean getDdlForLike, long specificVersion) {
+ boolean hidePassword, boolean getDdlForLike, long specificVersion, boolean getBriefDdl) {
StringBuilder sb = new StringBuilder();
// 1. create table
@@ -2888,7 +2888,8 @@ public class Env {
if (separatePartition) {
partitionId = Lists.newArrayList();
}
- if (partitionInfo.getType() == PartitionType.RANGE || partitionInfo.getType() == PartitionType.LIST) {
+ if (!getBriefDdl && (partitionInfo.getType() == PartitionType.RANGE
+ || partitionInfo.getType() == PartitionType.LIST)) {
sb.append("\n").append(partitionInfo.toSql(olapTable, partitionId));
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index bed44e7e25..1947d17a66 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -1196,7 +1196,8 @@ public class InternalCatalog implements CatalogIf {
throw new DdlException("Table[" + table.getName() + "] is external, not support rollup copy");
}
- Env.getDdlStmt(stmt, stmt.getDbName(), table, createTableStmt, null, null, false, false, true, -1L);
+ Env.getDdlStmt(stmt, stmt.getDbName(), table, createTableStmt, null, null, false, false, true, -1L,
+ false);
if (createTableStmt.isEmpty()) {
ErrorReport.reportDdlException(ErrorCode.ERROR_CREATE_TABLE_LIKE_EMPTY, "CREATE");
}
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 359092f16c..690eab65c3 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
@@ -990,7 +990,8 @@ public class ShowExecutor {
return;
}
List createTableStmt = Lists.newArrayList();
- Env.getDdlStmt(table, createTableStmt, null, null, false, true /* hide password */, -1L);
+ Env.getDdlStmt(null, null, table, createTableStmt, null, null, false,
+ true /* hide password */, false, -1L, showStmt.isNeedBriefDdl());
if (createTableStmt.isEmpty()) {
resultSet = new ShowResultSet(showStmt.getMetaData(), rows);
return;
diff --git a/fe/fe-core/src/main/jflex/sql_scanner.flex b/fe/fe-core/src/main/jflex/sql_scanner.flex
index e00ee2eae7..69dfe64dec 100644
--- a/fe/fe-core/src/main/jflex/sql_scanner.flex
+++ b/fe/fe-core/src/main/jflex/sql_scanner.flex
@@ -123,6 +123,7 @@ import org.apache.doris.qe.SqlModeHelper;
keywordMap.put("ngram_bf", new Integer(SqlParserSymbols.KW_NGRAM_BF));
keywordMap.put("blob", new Integer(SqlParserSymbols.KW_BLOB));
keywordMap.put("boolean", new Integer(SqlParserSymbols.KW_BOOLEAN));
+ keywordMap.put("brief", new Integer(SqlParserSymbols.KW_BRIEF));
keywordMap.put("broker", new Integer(SqlParserSymbols.KW_BROKER));
keywordMap.put("buckets", new Integer(SqlParserSymbols.KW_BUCKETS));
keywordMap.put("build", new Integer(SqlParserSymbols.KW_BUILD));
diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowCreateTableStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowCreateTableStmtTest.java
index 3037bb0d8a..fe9adf9ccd 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowCreateTableStmtTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/ShowCreateTableStmtTest.java
@@ -32,7 +32,13 @@ public class ShowCreateTableStmtTest extends TestWithFeService {
createDatabase("test");
useDatabase("test");
createTable("create table table1\n"
- + "(k1 int comment 'test column k1', k2 int comment 'test column k2') comment 'test table1' distributed by hash(k1) buckets 1\n"
+ + "(k1 int comment 'test column k1', k2 int comment 'test column k2') comment 'test table1' "
+ + "PARTITION BY RANGE(`k1`)\n"
+ + "(\n"
+ + " PARTITION `p01` VALUES LESS THAN (\"10\"),\n"
+ + " PARTITION `p02` VALUES LESS THAN (\"100\")\n"
+ + ") "
+ + "distributed by hash(k1) buckets 1\n"
+ "properties(\"replication_num\" = \"1\");");
}
@@ -46,4 +52,12 @@ public class ShowCreateTableStmtTest extends TestWithFeService {
Assertions.assertTrue(showSql.contains("COMMENT 'test table1'"));
}
+ @Test
+ public void testBrief() throws Exception {
+ String sql = "show brief create table table1";
+ ShowResultSet showResultSet = showCreateTable(sql);
+ String showSql = showResultSet.getResultRows().get(0).get(1);
+ Assertions.assertTrue(!showSql.contains("PARTITION BY"));
+ Assertions.assertTrue(!showSql.contains("PARTITION `p01`"));
+ }
}