Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.9k
[opt](schema) Optimize tables schema scan status#64933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
liaoxin01
merged 4 commits into
apache:master
from
0AyanamiRei:optimize-schema-tables-statusJul 7, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
74a8dd7
[opt](schema) Optimize tables schema scan status
0AyanamiRei 48fe249
[fix](fe) Set last check time for check time projection
0AyanamiRei 3724362
[test](regression) Add schema status column pruning coverage
0AyanamiRei c376edd
Merge branch 'master' into optimize-schema-tables-status
0AyanamiRei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 24 additions & 8 deletions
32 fe/fe-core/src/main/java/org/apache/doris/catalog/LocalTablet.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 27 additions & 21 deletions
48 fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34 fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 50 additions & 10 deletions
60 fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -350,6 +350,7 @@ | ||
| import java.util.HashMap; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Random; | ||
| @@ -660,6 +661,11 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE | ||
| TListTableStatusResult result = new TListTableStatusResult(); | ||
| List<TTableStatus> tablesResult = Lists.newArrayList(); | ||
| result.setTables(tablesResult); | ||
| Set<String> requiredColumns = params.isSetRequiredColumns() | ||
| ? params.getRequiredColumns().stream() | ||
| .map(column -> column.toUpperCase(Locale.ROOT)) | ||
| .collect(Collectors.toSet()) | ||
| : null; | ||
| PatternMatcher matcher = null; | ||
| String specifiedTable = null; | ||
| if (params.isSetPattern()) { | ||
| @@ -739,17 +745,40 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE | ||
| TTableStatus status = new TTableStatus(); | ||
| status.setName(table.getName()); | ||
| status.setType(table.getMysqlType()); | ||
| status.setEngine(table.getEngine()); | ||
| status.setComment(table.getComment()); | ||
| status.setCreateTime(table.getCreateTime()); | ||
| status.setLastCheckTime(lastCheckTime / 1000); | ||
| status.setUpdateTime(table.getUpdateTime() / 1000); | ||
| status.setCheckTime(lastCheckTime / 1000); | ||
| status.setCollation("utf-8"); | ||
| status.setRows(table.getCachedRowCount()); | ||
| status.setDataLength(table.getDataLength()); | ||
| status.setAvgRowLength(table.getAvgRowLength()); | ||
| status.setIndexLength(table.getIndexLength()); | ||
| if (needTableStatusColumn(requiredColumns, "ENGINE")) { | ||
| status.setEngine(table.getEngine()); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "CREATE_TIME")) { | ||
| status.setCreateTime(table.getCreateTime()); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "LAST_CHECK_TIME") | ||
| || needTableStatusColumn(requiredColumns, "CHECK_TIME")) { | ||
| status.setLastCheckTime(lastCheckTime / 1000); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "UPDATE_TIME")) { | ||
| status.setUpdateTime(table.getUpdateTime() / 1000); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "CHECK_TIME")) { | ||
0AyanamiRei marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| status.setCheckTime(lastCheckTime / 1000); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "TABLE_COLLATION")) { | ||
| status.setCollation("utf-8"); | ||
| } | ||
| TableIf.TableStatusStats tableStatusStats = | ||
| needTableStatusStats(requiredColumns) ? table.getTableStatusStats() : null; | ||
| if (needTableStatusColumn(requiredColumns, "TABLE_ROWS")) { | ||
| status.setRows(tableStatusStats.getRows()); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "DATA_LENGTH")) { | ||
| status.setDataLength(tableStatusStats.getDataLength()); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "AVG_ROW_LENGTH")) { | ||
| status.setAvgRowLength(tableStatusStats.getAvgRowLength()); | ||
| } | ||
| if (needTableStatusColumn(requiredColumns, "INDEX_LENGTH")) { | ||
| status.setIndexLength(tableStatusStats.getIndexLength()); | ||
| } | ||
| if (table instanceof View) { | ||
| status.setDdlSql(((View) table).getInlineViewDef()); | ||
| } | ||
| @@ -766,6 +795,17 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE | ||
| return result; | ||
| } | ||
| private static boolean needTableStatusColumn(Set<String> requiredColumns, String columnName) { | ||
| return requiredColumns == null || requiredColumns.contains(columnName); | ||
| } | ||
| private static boolean needTableStatusStats(Set<String> requiredColumns) { | ||
| return needTableStatusColumn(requiredColumns, "TABLE_ROWS") | ||
| || needTableStatusColumn(requiredColumns, "DATA_LENGTH") | ||
| || needTableStatusColumn(requiredColumns, "AVG_ROW_LENGTH") | ||
| || needTableStatusColumn(requiredColumns, "INDEX_LENGTH"); | ||
| } | ||
| public TListTableMetadataNameIdsResult listTableMetadataNameIds(TGetTablesParams params) throws TException { | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("get list simple table request: {}", params); | ||
36 changes: 36 additions & 0 deletions
36 fe/fe-core/src/test/java/org/apache/doris/catalog/OlapTableTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17 fe/fe-core/src/test/java/org/apache/doris/catalog/TabletTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.