freemandealer commented on code in PR #32030:
URL: https://github.com/apache/doris/pull/32030#discussion_r1520809331
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java:
##########
@@ -974,4 +976,28 @@ public static boolean isMvColumn(TableIf table, String
columnName) {
||
columnName.startsWith(CreateMaterializedViewStmt.MATERIALIZED_VIEW_AGGREGATE_NAME_PREFIX);
}
+ public static boolean isEmptyTable(TableIf table,
AnalysisInfo.AnalysisMethod method) {
+ int waitRowCountReportedTime = 90;
+ if (!(table instanceof OlapTable) ||
method.equals(AnalysisInfo.AnalysisMethod.FULL)) {
+ return false;
+ }
+ OlapTable olapTable = (OlapTable) table;
+ for (int i = 0; i < waitRowCountReportedTime; i++) {
+ if (olapTable.getRowCount() > 0) {
+ return false;
+ }
+ // If visible version is 2, table is probably not empty. So we
wait row count to be reported.
+ // If visible version is not 2 and getRowCount return 0, we assume
it is an empty table.
+ if (olapTable.getVisibleVersion() !=
TableAttributes.TABLE_INIT_VERSION + 1) {
+ return true;
+ }
+ try {
+ Thread.sleep(1000);
Review Comment:
A delay for auto analysis is acceptable, but what if it is a manual one with
sync? Queuing in the task queue will make users wait longer.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]