wangshuo128 commented on a change in pull request #7434:
URL: https://github.com/apache/incubator-doris/pull/7434#discussion_r773616658
##########
File path: fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
##########
@@ -111,10 +125,159 @@ public void computeColumnFilter() {
if (null == slotDesc) {
continue;
}
+ // Set `columnFilters` all the time because `DistributionPruner`
also use this.
+ // Maybe we could use `columnNameToRange` for `DistributionPruner`
and
+ // only create `columnFilters` when
`partition_prune_algorithm_version` is 1.
PartitionColumnFilter keyFilter = createPartitionFilter(slotDesc,
conjuncts);
if (null != keyFilter) {
columnFilters.put(column.getName(), keyFilter);
}
+
+ if
(analyzer.getContext().getSessionVariable().getPartitionPruneAlgorithmVersion()
== 2) {
+ ColumnRange columnRange = createColumnRange(slotDesc,
conjuncts);
+ if (columnRange != null) {
+ columnNameToRange.put(column.getName(), columnRange);
+ }
+ }
+
+ }
+ }
+
+ private ColumnRange createColumnRange(SlotDescriptor desc,
+ List<Expr> conjuncts) {
+ ColumnRange result = null;
+ for (Expr expr : conjuncts) {
+ if (!expr.isBound(desc.getId())) {
+ continue;
+ }
+
+ // Finish early if we have ever met `is null` predicate.
+ if (result != null && result.hasConjunctiveIsNull()) {
+ return result;
+ }
+
+ if (expr instanceof CompoundPredicate &&
+ ((CompoundPredicate) expr).getOp() ==
CompoundPredicate.Operator.OR) {
+ // Try to get column filter from disjunctive predicates.
+ List<Expr> disjunctivePredicates =
PredicateUtils.splitDisjunctivePredicates(expr);
+ if (disjunctivePredicates.isEmpty()) {
Review comment:
Yeap, internal states of `ColumnRange` have been simplified.
--
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]