Skip to content

Commit

Permalink
[information_schema](tables)modify information_schema.tables rows col…
Browse files Browse the repository at this point in the history
…umn use cache rows
  • Loading branch information
hubgeter committed Nov 15, 2023
1 parent 760c6cd commit a6172bf
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,11 @@ public long getRowCount() {
return rowCount;
}

@Override
public long getCacheRowCount() {
return getRowCount();
}

@Override
public long getAvgRowLength() {
long rowCount = 0;
Expand Down
4 changes: 4 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ public long getRowCount() {
return 0;
}

public long getCacheRowCount() {
return getRowCount();
}

public long getAvgRowLength() {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ default int getBaseColumnIdxByName(String colName) {

long getRowCount();

long getCacheRowCount();

long getDataLength();

long getAvgRowLength();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ public long getRowCount() {
return 0;
}

public long getCacheRowCount() {
return 0;
}

@Override
public long getAvgRowLength() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,23 @@ public List<Column> getHudiSchema(List<FieldSchema> hmsSchema) {
return tmpSchema;
}

@Override
public long getCacheRowCount() {
//Cached accurate information
TableStatsMeta tableStats = Env.getCurrentEnv().getAnalysisManager().findTableStatsStatus(id);
if (tableStats != null) {
long rowCount = tableStats.rowCount;
LOG.debug("Estimated row count for db {} table {} is {}.", dbName, name, rowCount);
return rowCount;
}

//estimated information
if (estimatedRowCount != -1) {
return estimatedRowCount;
}
return -1;
}

@Override
public long estimatedRowCount() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public long getRowCount() {
return 1;
}

@Override
public long getCacheRowCount() {
return getRowCount();
}

@Override
public long estimatedRowCount() {
return getRowCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE
status.setUpdateTime(table.getUpdateTime() / 1000);
status.setCheckTime(lastCheckTime / 1000);
status.setCollation("utf-8");
status.setRows(table.getRowCount());
status.setRows(table.getCacheRowCount());
status.setDataLength(table.getDataLength());
status.setAvgRowLength(table.getAvgRowLength());
tablesResult.add(status);
Expand Down

0 comments on commit a6172bf

Please sign in to comment.