morningman commented on code in PR #31276:
URL: https://github.com/apache/doris/pull/31276#discussion_r1499469076


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java:
##########
@@ -649,4 +627,9 @@ public Map<String, Set<String>> 
findReAnalyzeNeededPartitions() {
     public List<Long> getChunkSizes() {
         throw new NotImplementedException("getChunkSized not implemented");
     }
+
+    @Override
+    public long fetchRowCount() {
+        throw new NotImplementedException("Internal table doesn't implement 
fetchRowCount");

Review Comment:
   How about implement this method as `getRowCount()`, and in `getRowCount()`, 
call `fetchRowCount()` directly?
   So that the meaning of `fetchRowCount()` is same among all kinds of tables: 
fetch the row count.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalRowCountCache.java:
##########
@@ -0,0 +1,113 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.datasource;
+
+import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.Config;
+import org.apache.doris.statistics.BasicAsyncCacheLoader;
+import org.apache.doris.statistics.StatisticConstants;
+import org.apache.doris.statistics.util.StatisticsUtil;
+
+import com.github.benmanes.caffeine.cache.AsyncLoadingCache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.time.Duration;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+
+public class ExternalRowCountCache {
+
+    private static final Logger LOG = 
LogManager.getLogger(ExternalRowCountCache.class);
+    private final AsyncLoadingCache<RowCountKey, Optional<Long>> rowCountCache;
+
+    public ExternalRowCountCache(ExecutorService executor) {
+        rowCountCache = Caffeine.newBuilder()
+                .maximumSize(Config.max_external_table_row_count_cache_num)
+                
.expireAfterWrite(Duration.ofHours(StatisticConstants.EXTERNAL_ROW_COUNT_EXPIRE_INTERVAL_HOURS))

Review Comment:
   How about using `Config.external_cache_expire_time_minutes_after_access`, 
same as other external meta cache



##########
fe/fe-core/src/main/java/org/apache/doris/statistics/util/StatisticsUtil.java:
##########
@@ -657,7 +656,7 @@ public static long getRowCountFromFileList(HMSExternalTable 
table) {
             estimatedRowSize += column.getDataType().getSlotSize();
         }
         if (estimatedRowSize == 0) {
-            return 1;
+            return 0;

Review Comment:
   For `getRowCountFromFileList()`, I think we need to check if this is a hive 
table or not.
   Only hive table support get row count from file list.



-- 
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]

Reply via email to