[Fix](Nereids) fix test leading change disable join reorder parameter (#23657)

Problem:
when running pipeline, we get randomly failed of test_leading
Reason:
physical distribute was generated and choosed to be the best plan because we can not get any statistic information of empty table. So we would get some unexpect result because we can not expect the order in memo
Solved:
Add statistic of columns used in test_leading, try repeatly in pipeline
This commit is contained in:
LiBinfeng
2023-10-16 11:59:45 +08:00
committed by GitHub
parent d00d029ffb
commit 29d4e8ee90
5 changed files with 103 additions and 78 deletions

View File

@ -17,6 +17,7 @@
package org.apache.doris.nereids.rules.rewrite;
import org.apache.doris.common.DdlException;
import org.apache.doris.nereids.hint.Hint;
import org.apache.doris.nereids.hint.LeadingHint;
import org.apache.doris.nereids.jobs.JobContext;
@ -41,7 +42,12 @@ public class LeadingJoin extends DefaultPlanRewriter<LeadingContext> implements
(LeadingHint) leadingHint, ((LeadingHint) leadingHint)
.getLeadingTableBitmap(jobContext.getCascadesContext().getTables())));
if (leadingHint.isSuccess()) {
jobContext.getCascadesContext().getConnectContext().getSessionVariable().setDisableJoinReorder(true);
try {
jobContext.getCascadesContext().getConnectContext().getSessionVariable()
.disableNereidsJoinReorderOnce();
} catch (DdlException e) {
throw new RuntimeException(e);
}
} else {
return plan;
}

View File

@ -2629,6 +2629,14 @@ public class SessionVariable implements Serializable, Writable {
VariableMgr.setVar(this, new SetVar(SessionVariable.ENABLE_NEREIDS_PLANNER, new StringLiteral("false")));
}
public void disableNereidsJoinReorderOnce() throws DdlException {
if (!enableNereidsPlanner) {
return;
}
setIsSingleSetVar(true);
VariableMgr.setVar(this, new SetVar(SessionVariable.DISABLE_JOIN_REORDER, new StringLiteral("false")));
}
// return number of variables by given variable annotation
public int getVariableNumByVariableAnnotation(VariableAnnotation type) {
int num = 0;