Skip to content

Commit

Permalink
rename stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Yulei-Yang committed Dec 5, 2023
1 parent 7806607 commit 91c3121
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
{
"title": "SHOW-ANALYZE-TABLETS",
"title": "SHOW-TABLETS-BELONG",
"language": "en"
}
---
Expand All @@ -26,13 +26,13 @@ under the License.

<version since="dev">

## SHOW-ANALYZE-TABLETS
## SHOW-TABLETS-BELONG

</version>

### Name

SHOW ANALYZE TABLETS
SHOW TABLETS BELONG

### Description

Expand All @@ -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:
Expand All @@ -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;
```

```
Expand All @@ -68,7 +68,7 @@ illustrate:

### Keywords

SHOW, ANALYZE, TABLETS
SHOW, TABLETS, BELONG

### Best Practice

2 changes: 1 addition & 1 deletion docs/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
{
"title": "SHOW-ANALYZE-TABLETS",
"title": "SHOW-TABLETS-BELONG",
"language": "zh-CN"
}
---
Expand All @@ -26,13 +26,13 @@ under the License.

<version since="dev">

## SHOW-ANALYZE-TABLETS
## SHOW-TABLETS-BELONG

</version>

### Name

SHOW ANALYZE TABLETS
SHOW TABLETS BELONG

### Description

Expand All @@ -41,20 +41,20 @@ 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

1. 展示3个tablet-id的相关信息(tablet-id可去重)

```sql
SHOW ANALYZE TABLETS 27028,78880,78382,27028;
SHOW TABLETS BELONG 27028,78880,78382,27028;
```

```
Expand All @@ -68,7 +68,7 @@ SHOW ANALYZE TABLETS tablet-ids;

### Keywords

SHOW, ANALYZE, TABLETS
SHOW, TABLETS, BELONG

### Best Practice

9 changes: 5 additions & 4 deletions fe/fe-core/src/main/cup/sql_parser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ terminal String
KW_BACKENDS,
KW_BACKUP,
KW_BEGIN,
KW_BELONG,
KW_BETWEEN,
KW_BIGINT,
KW_BIN,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Long> tabletIds;

private static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>()
Expand All @@ -44,7 +44,7 @@ public class ShowAnalyzeTabletsStmt extends ShowStmt {
.add("TabletIds")
.build();

public ShowAnalyzeTabletsStmt(List<Long> tabletIds) {
public ShowTabletsBelongStmt(List<Long> tabletIds) {
this.tabletIds = tabletIds;
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2710,7 +2710,7 @@ private void handleShowAnalyze() {
}

private void handleShowAnalyzeTablet() {
ShowAnalyzeTabletsStmt showStmt = (ShowAnalyzeTabletsStmt) stmt;
ShowTabletsBelongStmt showStmt = (ShowTabletsBelongStmt) stmt;
List<List<String>> rows = new ArrayList<>();

Env env = Env.getCurrentEnv();
Expand Down
1 change: 1 addition & 0 deletions fe/fe-core/src/main/jflex/sql_scanner.flex
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 91c3121

Please sign in to comment.