Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Feb 28, 2024
1 parent 3fadf18 commit 2315875
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.apache.doris.nereids.rules.rewrite.CheckDataTypes;
import org.apache.doris.nereids.rules.rewrite.CheckMatchExpression;
import org.apache.doris.nereids.rules.rewrite.CheckMultiDistinct;
import org.apache.doris.nereids.rules.rewrite.CheckPrivilege;
import org.apache.doris.nereids.rules.rewrite.CheckPrivileges;
import org.apache.doris.nereids.rules.rewrite.CollectFilterAboveConsumer;
import org.apache.doris.nereids.rules.rewrite.CollectProjectAboveConsumer;
import org.apache.doris.nereids.rules.rewrite.ColumnPruning;
Expand Down Expand Up @@ -241,7 +241,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
// 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, CheckPrivilege::new),
custom(RuleType.CHECK_PRIVILEGES, CheckPrivileges::new),
bottomUp(new InlineLogicalView())
),
topic("Eliminate optimization",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void setVar(SelectHintSetVar selectHint, StatementContext context) {
}
throw new AnalysisException("The nereids is disabled in this sql, fallback to original planner");
}
context.invalidCache(SessionVariable.DISABLE_NEREIDS_RULES);
context.invalidCache(selectHint.getHintName());
}

private void extractLeading(SelectHintLeading selectHint, CascadesContext context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import java.util.Set;
import java.util.stream.Collectors;

/** CheckPrivilege */
public class CheckPrivilege extends ColumnPruning {
/** CheckPrivileges */
public class CheckPrivileges extends ColumnPruning {
private JobContext jobContext;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.Optional;

/**
* LogicalTestTable.
* LogicalTestScan.
*
* only for ut
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2612,9 +2612,11 @@ public int getNthOptimizedPlan() {

public Set<String> getDisableNereidsRuleNames() {
String checkPrivilege = RuleType.CHECK_PRIVILEGES.name();
String checkRowPolicy = RuleType.CHECK_ROW_POLICY.name();
return Arrays.stream(disableNereidsRules.split(",[\\s]*"))
.map(rule -> rule.toUpperCase(Locale.ROOT))
.filter(rule -> !StringUtils.equalsIgnoreCase(rule, checkPrivilege))
.filter(rule -> !StringUtils.equalsIgnoreCase(rule, checkPrivilege)
&& !StringUtils.equalsIgnoreCase(rule, checkRowPolicy))
.collect(ImmutableSet.toImmutableSet());
}

Expand All @@ -2623,7 +2625,8 @@ public Set<Integer> getDisableNereidsRules() {
.filter(rule -> !rule.isEmpty())
.map(rule -> rule.toUpperCase(Locale.ROOT))
.map(rule -> RuleType.valueOf(rule))
.filter(ruleType -> ruleType != RuleType.CHECK_PRIVILEGES)
.filter(ruleType -> ruleType != RuleType.CHECK_PRIVILEGES
&& ruleType != RuleType.CHECK_ROW_POLICY)
.map(RuleType::type)
.collect(ImmutableSet.toImmutableSet());
}
Expand Down

0 comments on commit 2315875

Please sign in to comment.