From 06c68c94c8e1a0645513c9d331d15a73b63014bf Mon Sep 17 00:00:00 2001 From: changyuwei <2017501503@qq.com> Date: Tue, 25 Jul 2023 01:24:24 +0800 Subject: [PATCH] [opt](hive)opt select count(*) stmt push down agg on hive --- .../java/org/apache/doris/planner/OlapScanNode.java | 4 +--- .../apache/doris/planner/external/HiveScanNode.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java index 8ab7fcf243aca3d..7b3e95c3a0b544e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java @@ -100,7 +100,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -355,8 +354,7 @@ public void ignoreConjuncts(Expr whereExpr) { return; } Expr vconjunct = convertConjunctsToAndCompoundPredicate(conjuncts).replaceSubPredicate(whereExpr); - conjuncts = splitAndCompoundPredicateToConjuncts(vconjunct).stream().filter(Objects::nonNull) - .collect(Collectors.toList()); + conjuncts = splitAndCompoundPredicateToConjuncts(vconjunct).stream().collect(Collectors.toList()); } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanNode.java index de034e54941ebf7..f43a6b1dce95e9f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/external/HiveScanNode.java @@ -150,7 +150,12 @@ protected List getPartitions() throws AnalysisException { ListPartitionItem listPartitionItem = (ListPartitionItem) idToPartitionItem.get(id); partitionValuesList.add(listPartitionItem.getItems().get(0).getPartitionValuesAsStringList()); } - return cache.getAllPartitions(hmsTable.getDbName(), hmsTable.getName(), partitionValuesList); + List allPartitions = + cache.getAllPartitions(hmsTable.getDbName(), hmsTable.getName(), partitionValuesList); + if (ConnectContext.get().getExecutor() != null) { + ConnectContext.get().getExecutor().getSummaryProfile().setGetPartitionsFinishTime(); + } + return allPartitions; } else { // unpartitioned table, create a dummy partition to save location and inputformat, // so that we can unify the interface. @@ -159,6 +164,9 @@ protected List getPartitions() throws AnalysisException { hmsTable.getRemoteTable().getSd().getLocation(), null); this.totalPartitionNum = 1; this.readPartitionNum = 1; + if (ConnectContext.get().getExecutor() != null) { + ConnectContext.get().getExecutor().getSummaryProfile().setGetPartitionsFinishTime(); + } return Lists.newArrayList(dummyPartition); } } @@ -191,6 +199,9 @@ private void getFileSplitByPartitions(HiveMetaStoreCache cache, List