Skip to content

Commit

Permalink
[feature](Nereids): InferPredicates support In (apache#29458) (apache…
Browse files Browse the repository at this point in the history
…#30525)

(cherry picked from commit 7a0734d)
  • Loading branch information
jackwener authored and caiconghui1 committed Feb 2, 2024
1 parent 91a4b2f commit 21af559
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.jobs.Job;
import org.apache.doris.qe.SessionVariable;

import java.util.concurrent.TimeUnit;

Expand All @@ -29,11 +30,14 @@ public class SimpleJobScheduler implements JobScheduler {
@Override
public void executeJobPool(ScheduleContext scheduleContext) {
JobPool pool = scheduleContext.getJobPool();
CascadesContext context = (CascadesContext) scheduleContext;
SessionVariable sessionVariable = context.getConnectContext().getSessionVariable();
while (!pool.isEmpty()) {
CascadesContext context = (CascadesContext) scheduleContext;
if (context.getConnectContext().getSessionVariable().enableNereidsTimeout
&& context.getStatementContext().getStopwatch().elapsed(TimeUnit.MILLISECONDS) > 5000) {
throw new RuntimeException("Nereids cost too much time ( > 5s )");
if (sessionVariable.enableNereidsTimeout
&& context.getStatementContext().getStopwatch().elapsed(TimeUnit.MILLISECONDS)
> sessionVariable.nereidsTimeoutSecond * 1000L) {
throw new RuntimeException(
"Nereids cost too much time ( > " + sessionVariable.nereidsTimeoutSecond + "s )");
}
Job job = pool.pop();
job.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,9 @@ public void setMaxJoinNumberOfReorder(int maxJoinNumberOfReorder) {
@VariableMgr.VarAttr(name = ENABLE_NEW_SHUFFLE_HASH_METHOD)
public boolean enableNewShuffleHashMethod = true;

@VariableMgr.VarAttr(name = "nereids_timeout_second", needForward = true)
public int nereidsTimeoutSecond = 5;

@VariableMgr.VarAttr(name = ENABLE_PUSH_DOWN_NO_GROUP_AGG)
public boolean enablePushDownNoGroupAgg = true;

Expand Down

0 comments on commit 21af559

Please sign in to comment.