dutyu commented on code in PR #23391: URL: https://github.com/apache/doris/pull/23391#discussion_r1320536775
########## fe/fe-core/src/main/java/org/apache/doris/qe/cache/CacheAnalyzer.java: ########## @@ -417,6 +384,51 @@ private CacheMode innerCheckCacheModeForNereids(long now) { return CacheMode.None; } + private List<CacheTable> buildCacheTableList() { + //Check the last version time of the table + MetricRepo.COUNTER_QUERY_TABLE.increase(1L); + long olapScanNodeSize = scanNodes.stream().filter(node -> node instanceof OlapScanNode).count(); + long hiveScanNodeSize = scanNodes.stream().filter(node -> node instanceof HiveScanNode).count(); + if (olapScanNodeSize > 0) { + MetricRepo.COUNTER_QUERY_OLAP_TABLE.increase(1L); + } + if (hiveScanNodeSize > 0) { + MetricRepo.COUNTER_QUERY_HIVE_TABLE.increase(1L); + } + + if (!(olapScanNodeSize == scanNodes.size() || hiveScanNodeSize == scanNodes.size())) { + LOG.debug("only support olap/hive table with non-federated query, other types are not supported now, " + + "queryId {}", DebugUtil.printId(queryId)); + return Collections.emptyList(); + } + + List<CacheTable> tblTimeList = Lists.newArrayList(); + for (int i = 0; i < scanNodes.size(); i++) { + ScanNode node = scanNodes.get(i); + if (enablePartitionCache() + && (node instanceof OlapScanNode) + && ((OlapScanNode) node).getSelectedPartitionNum() > 1 + && selectStmt != null + && selectStmt.hasGroupByClause()) { + LOG.debug("more than one partition scanned when qeury has agg, partition cache cannot use, queryid {}", + DebugUtil.printId(queryId)); + return Collections.emptyList(); + } + CacheTable cTable = node instanceof OlapScanNode + ? buildCacheTableForOlapScanNode((OlapScanNode) node) + : buildCacheTableForHiveScanNode((HiveScanNode) node); + tblTimeList.add(cTable); + } + if (olapScanNodeSize > 0) { Review Comment: I've checked my code again, and i do not find any other place which added `cTable` before, just here. -- 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