Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Dec 29, 2023
1 parent 03e40ff commit c88a81b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ public enum RuleType {
STORAGE_LAYER_AGGREGATE_WITH_PROJECT(RuleTypeClass.IMPLEMENTATION),
STORAGE_LAYER_AGGREGATE_WITHOUT_PROJECT_FOR_FILE_SCAN(RuleTypeClass.IMPLEMENTATION),
STORAGE_LAYER_AGGREGATE_WITH_PROJECT_FOR_FILE_SCAN(RuleTypeClass.IMPLEMENTATION),
MINMAX_ON_UNIQUE_TABLE(RuleTypeClass.IMPLEMENTATION),
MINMAX_ON_UNIQUE_TABLE_WITHOUT_PROJECT(RuleTypeClass.IMPLEMENTATION),
STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE(RuleTypeClass.IMPLEMENTATION),
STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE_WITHOUT_PROJECT(RuleTypeClass.IMPLEMENTATION),
COUNT_ON_INDEX(RuleTypeClass.IMPLEMENTATION),
COUNT_ON_INDEX_WITHOUT_PROJECT(RuleTypeClass.IMPLEMENTATION),
ONE_PHASE_AGGREGATE_WITHOUT_DISTINCT(RuleTypeClass.IMPLEMENTATION),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,22 @@ public List<Rule> buildRules() {
return pushdownCountOnIndex(agg, project, filter, olapScan, ctx.cascadesContext);
})
),
RuleType.MINMAX_ON_UNIQUE_TABLE_WITHOUT_PROJECT.build(
RuleType.STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE_WITHOUT_PROJECT.build(
logicalAggregate(
logicalFilter(
logicalOlapScan().when(this::isUniqueKeyTable))
.when(filter -> filter.getConjuncts().size() == 1))
.when(filter -> {
if (filter.getConjuncts().size() != 1) {
return false;
}
Expression childExpr = filter.getConjuncts().iterator().next().children().get(0);
if (childExpr instanceof SlotReference) {
String exprName = ((SlotReference) childExpr).getName();
return "__DORIS_DELETE_SIGN__".equalsIgnoreCase(exprName);
}
return false;
})
)
.when(agg -> enablePushDownMinMaxOnUnique())
.when(agg -> agg.getGroupByExpressions().size() == 0)
.when(agg -> {
Expand All @@ -163,12 +174,24 @@ public List<Rule> buildRules() {
ctx.cascadesContext);
})
),
RuleType.MINMAX_ON_UNIQUE_TABLE.build(
logicalAggregate(
logicalProject(
logicalFilter(
logicalOlapScan().when(this::isUniqueKeyTable))
.when(filter -> filter.getConjuncts().size() == 1)))
RuleType.STORAGE_LAYER_AGGREGATE_MINMAX_ON_UNIQUE.build(
logicalAggregate(
logicalProject(
logicalFilter(
logicalOlapScan().when(this::isUniqueKeyTable))
.when(filter -> {
if (filter.getConjuncts().size() != 1) {
return false;
}
Expression childExpr = filter.getConjuncts().iterator().next()
.children().get(0);
if (childExpr instanceof SlotReference) {
String exprName = ((SlotReference) childExpr).getName();
return "__DORIS_DELETE_SIGN__".equalsIgnoreCase(exprName);
}
return false;
}))
)
.when(agg -> enablePushDownMinMaxOnUnique())
.when(agg -> agg.getGroupByExpressions().size() == 0)
.when(agg -> {
Expand Down Expand Up @@ -448,14 +471,8 @@ private boolean checkWhetherPushDownMinMax(Set<AggregateFunction> aggregateFunct
outPutSlots);
for (SlotReference slot : usedSlotInTable) {
Column column = slot.getColumn().get();
// The zone map max length of CharFamily is 512, do not
// over the length: https://github.com/apache/doris/pull/6293
PrimitiveType colType = column.getType().getPrimitiveType();
if (colType.isComplexType() || colType.isHllType() || colType.isBitmapType()
|| colType == PrimitiveType.STRING) {
return false;
}
if (colType.isCharFamily() && column.getType().getLength() > 512) {
if (colType.isComplexType() || colType.isHllType() || colType.isBitmapType()) {
return false;
}
}
Expand Down

0 comments on commit c88a81b

Please sign in to comment.