Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Nov 10, 2024
1 parent 33b99da commit b12767f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,6 @@ public class Rewriter extends AbstractBatchJobExecutor {
// but it appeared at LogicalApply.right. After the `Subquery unnesting` topic, all slots is placed in a
// normal position, then we can check column privileges by these steps
//
// 1. use ColumnPruning rule to derive the used slots in LogicalView
// 2. and then check the column privileges
// 3. finally, we can eliminate the LogicalView
// topic("Inline view and check column privileges",
// custom(RuleType.CHECK_PRIVILEGES, CheckPrivileges::new),
// bottomUp(new InlineLogicalView())
// ),
topic("Eliminate optimization",
bottomUp(
new EliminateLimit(),
Expand All @@ -238,7 +231,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
)
),
// please note: this rule must run before NormalizeAggregate
// topDown(new AdjustAggregateNullableForEmptySet()),
topDown(new AdjustAggregateNullableForEmptySet()),
// The rule modification needs to be done after the subquery is unnested,
// because for scalarSubQuery, the connection condition is stored in apply in the analyzer phase,
// but when normalizeAggregate/normalizeSort is performed, the members in apply cannot be obtained,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public class ExtractCommonFactorRule implements ExpressionPatternRuleFactory {
@Override
public List<ExpressionPatternMatcher<? extends Expression>> buildRules() {
return ImmutableList.of(
matchesTopType(CompoundPredicate.class).then(this::extractCommonFactor)
matchesTopType(CompoundPredicate.class).then(ExtractCommonFactorRule::extractCommonFactor)
);
}

private Expression extractCommonFactor(CompoundPredicate originExpr) {
private static Expression extractCommonFactor(CompoundPredicate originExpr) {
// fast return
if (!(originExpr.left() instanceof CompoundPredicate || originExpr.left() instanceof BooleanLiteral)
&& !(originExpr.right() instanceof CompoundPredicate || originExpr.right() instanceof BooleanLiteral)) {
Expand Down Expand Up @@ -97,7 +97,7 @@ private Expression extractCommonFactor(CompoundPredicate originExpr) {
return result;
}

private Expression extractCommonFactors(CompoundPredicate originPredicate,
private static Expression extractCommonFactors(CompoundPredicate originPredicate,
CompoundPredicate leftDeapTreePredicate, List<List<Expression>> initPartitions) {
// extract factor and fill into commonFactorToPartIds
// e.g.
Expand Down Expand Up @@ -173,7 +173,7 @@ private Expression extractCommonFactors(CompoundPredicate originPredicate,
return ExpressionUtils.combineAsLeftDeepTree(leftDeapTreePredicate.getClass(), extractedExprs.build());
}

private Expression doExtractCommonFactors(
private static Expression doExtractCommonFactors(
CompoundPredicate originPredicate,
List<List<Expression>> partitions, Set<Integer> partitionIds, Set<Expression> commonFactors) {
ImmutableList.Builder<Expression> uncorrelatedExprPartitionsBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FoldConstantRule implements ExpressionPatternRuleFactory {
public List<ExpressionPatternMatcher<? extends Expression>> buildRules() {
return ImmutableList.<ExpressionPatternMatcher<? extends Expression>>builder()
.addAll(FoldConstantRuleOnFE.PATTERN_MATCH_INSTANCE.buildRules())
// .addAll(FoldConstantRuleOnBE.INSTANCE.buildRules())
.addAll(FoldConstantRuleOnBE.INSTANCE.buildRules())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ public class SimplifyRange implements ExpressionPatternRuleFactory {
public List<ExpressionPatternMatcher<? extends Expression>> buildRules() {
return ImmutableList.of(
matchesTopType(CompoundPredicate.class)
.thenApply(ctx -> this.rewrite(ctx.expr, ctx.rewriteContext))
.thenApply(ctx -> SimplifyRange.rewrite(ctx.expr, ctx.rewriteContext))
);
}

/** rewrite */
public Expression rewrite(CompoundPredicate expr, ExpressionRewriteContext context) {
public static Expression rewrite(CompoundPredicate expr, ExpressionRewriteContext context) {
if (SkipSimpleExprs.isSimpleExpr(expr)) {
return expr;
}
Expand Down

This file was deleted.

0 comments on commit b12767f

Please sign in to comment.