[improvement](Nereids): limit Memo groupExpression size. (#20272)

This commit is contained in:
jakevin
2023-06-01 13:30:19 +08:00
committed by GitHub
parent 519f01133a
commit 0ff3073fc4
3 changed files with 10 additions and 1 deletions

View File

@ -57,7 +57,9 @@ public class OptimizeGroupExpressionJob extends Job {
private List<Rule> getExplorationRules() {
boolean isDisableJoinReorder = context.getCascadesContext().getConnectContext().getSessionVariable()
.isDisableJoinReorder();
.isDisableJoinReorder()
|| context.getCascadesContext().getMemo().getGroupExpressionsSize() > context.getCascadesContext()
.getConnectContext().getSessionVariable().memoMaxGroupExpressionSize;
boolean isDpHyp = context.getCascadesContext().getStatementContext().isDpHyp();
boolean isEnableBushyTree = context.getCascadesContext().getConnectContext().getSessionVariable()
.isEnableBushyTree();

View File

@ -110,6 +110,10 @@ public class Memo {
return groupExpressions;
}
public int getGroupExpressionsSize() {
return groupExpressions.size();
}
private Plan skipProject(Plan plan, Group targetGroup) {
// Some top project can't be eliminated
if (plan instanceof LogicalProject && ((LogicalProject<?>) plan).canEliminate()) {

View File

@ -900,6 +900,9 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = DUMP_NEREIDS_MEMO)
public boolean dumpNereidsMemo = false;
@VariableMgr.VarAttr(name = "memo_max_group_expression_size")
public int memoMaxGroupExpressionSize = 40000;
@VariableMgr.VarAttr(name = ENABLE_MINIDUMP)
public boolean enableMinidump = false;