morrySnow commented on code in PR #46534: URL: https://github.com/apache/doris/pull/46534#discussion_r1906419075
########## fe/fe-core/src/main/java/org/apache/doris/statistics/OlapAnalysisTask.java: ########## @@ -95,15 +100,15 @@ protected void doSample() { if (LOG.isDebugEnabled()) { LOG.debug("Will do sample collection for column {}", col.getName()); } - Pair<List<Long>, Long> pair = calcActualSampleTablets(tbl.isPartitionColumn(col.getName())); + Pair<List<Long>, Long> pair = calcActualSampleTablets(); LOG.info("Number of tablets selected {}, rows in tablets {}", pair.first.size(), pair.second); List<Long> tabletIds = pair.first; long totalRowCount = info.indexId == -1 ? tbl.getRowCount() : ((OlapTable) tbl).getRowCountForIndex(info.indexId, false); double scaleFactor = (double) totalRowCount / (double) pair.second; // might happen if row count in fe metadata hasn't been updated yet - if (Double.isInfinite(scaleFactor) || Double.isNaN(scaleFactor)) { + if (Double.isInfinite(scaleFactor) || Double.isNaN(scaleFactor) || scaleFactor < 1 || tabletIds.isEmpty()) { Review Comment: could we simplify code in this function? change scaleFactor and pair.second many times. it is hard to understand -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org