Skip to content

Commit

Permalink
[opt](hive)opt select count(*) stmt push down agg on hive
Browse files Browse the repository at this point in the history
  • Loading branch information
hubgeter committed Jul 25, 2023
1 parent fa6fc32 commit 06c68c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ protected List<HivePartition> 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<HivePartition> 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.
Expand All @@ -159,6 +164,9 @@ protected List<HivePartition> 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);
}
}
Expand Down Expand Up @@ -191,6 +199,9 @@ private void getFileSplitByPartitions(HiveMetaStoreCache cache, List<HivePartiti
} else {
fileCaches = cache.getFilesByPartitions(partitions, useSelfSplitter);
}
if (ConnectContext.get().getExecutor() != null) {
ConnectContext.get().getExecutor().getSummaryProfile().setGetPartitionFilesFinishTime();
}
for (HiveMetaStoreCache.FileCacheValue fileCacheValue : fileCaches) {
// This if branch is to support old splitter, will remove later.
if (fileCacheValue.getSplits() != null) {
Expand Down

0 comments on commit 06c68c9

Please sign in to comment.