@@ -1131,22 +1131,45 @@ public static boolean needAnalyzeColumn(TableIf table, Pair<String, String> colu
11311131 // 3. Check partition
11321132 return needAnalyzePartition (olapTable , tableStatsStatus , columnStatsMeta );
11331133 } else {
1134- if (!(table instanceof HMSExternalTable || ( table instanceof IcebergExternalTable ) )) {
1134+ if (!StatisticsUtil . supportAutoAnalyze (table )) {
11351135 return false ;
11361136 }
1137- if (table instanceof HMSExternalTable ) {
1138- HMSExternalTable hmsTable = (HMSExternalTable ) table ;
1139- if (!hmsTable .getDlaType ().equals (DLAType .HIVE ) && !hmsTable .getDlaType ().equals (DLAType .ICEBERG )) {
1140- return false ;
1141- }
1142- }
11431137 // External is hard to calculate change rate, use time interval to control
11441138 // analyze frequency.
11451139 return System .currentTimeMillis ()
11461140 - tableStatsStatus .lastAnalyzeTime > StatisticsUtil .getExternalTableAutoAnalyzeIntervalInMillis ();
11471141 }
11481142 }
11491143
1144+ /**
1145+ * Check if the table supports auto analyze feature.
1146+ * @param table The table to check
1147+ * @return true if the table supports auto analyze, false otherwise
1148+ */
1149+ public static boolean supportAutoAnalyze (TableIf table ) {
1150+ if (table == null ) {
1151+ return false ;
1152+ }
1153+
1154+ // Support OLAP table
1155+ if (table instanceof OlapTable ) {
1156+ return true ;
1157+ }
1158+
1159+ // Support Iceberg table
1160+ if (table instanceof IcebergExternalTable ) {
1161+ return true ;
1162+ }
1163+
1164+ // Support HMS table (only HIVE and ICEBERG types)
1165+ if (table instanceof HMSExternalTable ) {
1166+ HMSExternalTable hmsTable = (HMSExternalTable ) table ;
1167+ DLAType dlaType = hmsTable .getDlaType ();
1168+ return dlaType .equals (DLAType .HIVE ) || dlaType .equals (DLAType .ICEBERG );
1169+ }
1170+ return false ;
1171+ }
1172+
11501173 public static boolean needAnalyzePartition (OlapTable table , TableStatsMeta tableStatsStatus ,
11511174 ColStatsMeta columnStatsMeta ) {
11521175 if (!StatisticsUtil .enablePartitionAnalyze () || !table .isPartitionedTable ()) {
0 commit comments