Skip to content

Commit

Permalink
enable_stats for external table
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Aug 12, 2024
1 parent 81438d5 commit 6070eb6
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,6 @@ private ColumnStatistic getColumnStatistic(TableIf table, String colName, long i
*/
private Statistics computeCatalogRelation(CatalogRelation catalogRelation) {
StatisticsBuilder builder = new StatisticsBuilder();
double tableRowCount = catalogRelation.getTable().getRowCount();

// for FeUt, use ColumnStatistic.UNKNOWN
if (!FeConstants.enableInternalSchemaDb
|| ConnectContext.get() == null
Expand All @@ -1067,15 +1065,14 @@ private Statistics computeCatalogRelation(CatalogRelation catalogRelation) {
}
}
Set<SlotReference> slotSet = slotSetBuilder.build();

double tableRowCount = catalogRelation.getTable().getRowCount();
if (tableRowCount <= 0) {
// try to get row count from col stats
for (SlotReference slot : slotSet) {
ColumnStatistic cache = getColumnStatsFromTableCache(catalogRelation, slot);
tableRowCount = Math.max(cache.count, tableRowCount);
}
}

for (SlotReference slot : slotSet) {
ColumnStatistic cache;
if (ConnectContext.get() != null && ! ConnectContext.get().getSessionVariable().enableStats) {
Expand Down

0 comments on commit 6070eb6

Please sign in to comment.