[improvement](iceberg/paimon)add show table stats (#31473)

This commit is contained in:
wuwenchi
2024-02-28 11:44:23 +08:00
committed by yiguolei
parent 5bbe9f7b40
commit d0a8a30998
4 changed files with 125 additions and 15 deletions

View File

@ -19,12 +19,9 @@ package org.apache.doris.datasource.iceberg;
import org.apache.doris.catalog.Column;
import org.apache.doris.datasource.ExternalTable;
import org.apache.doris.datasource.hive.HiveMetaStoreClientHelper;
import org.apache.doris.statistics.AnalysisInfo;
import org.apache.doris.statistics.BaseAnalysisTask;
import org.apache.doris.statistics.ColumnStatistic;
import org.apache.doris.statistics.ExternalAnalysisTask;
import org.apache.doris.statistics.util.StatisticsUtil;
import org.apache.doris.thrift.THiveTable;
import org.apache.doris.thrift.TIcebergTable;
import org.apache.doris.thrift.TTableDescriptor;
@ -32,7 +29,6 @@ import org.apache.doris.thrift.TTableType;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
public class IcebergExternalTable extends ExternalTable {
@ -74,14 +70,6 @@ public class IcebergExternalTable extends ExternalTable {
}
}
@Override
public Optional<ColumnStatistic> getColumnStatistic(String colName) {
makeSureInitialized();
return HiveMetaStoreClientHelper.ugiDoAs(catalog.getConfiguration(),
() -> StatisticsUtil.getIcebergColumnStats(colName,
IcebergUtils.getIcebergTable(catalog, dbName, name)));
}
@Override
public BaseAnalysisTask createAnalysisTask(AnalysisInfo info) {
makeSureInitialized();

View File

@ -2549,11 +2549,9 @@ public class ShowExecutor {
TableIf tableIf = showTableStatsStmt.getTable();
TableStatsMeta tableStats = Env.getCurrentEnv().getAnalysisManager().findTableStatsStatus(tableIf.getId());
/*
HMSExternalTable table will fetch row count from HMS
or estimate with file size and schema if it's not analyzed.
tableStats == null means it's not analyzed, in this case show the estimated row count.
*/
if (tableStats == null && tableIf instanceof HMSExternalTable) {
if (tableStats == null) {
resultSet = showTableStatsStmt.constructResultSet(tableIf.getRowCount());
} else {
resultSet = showTableStatsStmt.constructResultSet(tableStats);