Skip to content

Commit

Permalink
fix sql cache throw npe in cloud mode
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Jan 20, 2025
1 parent 7f0285c commit 0351051
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ public class NereidsCoordinator extends Coordinator {

protected volatile PipelineExecutionTask executionTask;

private final boolean needEnqueue;

// sql execution
public NereidsCoordinator(ConnectContext context, Analyzer analyzer,
NereidsPlanner planner, StatsErrorEstimator statsErrorEstimator) {
super(context, analyzer, planner, statsErrorEstimator);

this.coordinatorContext = CoordinatorContext.buildForSql(planner, this);
this.coordinatorContext.setJobProcessor(buildJobProcessor(coordinatorContext));
this.needEnqueue = true;

Preconditions.checkState(!planner.getFragments().isEmpty()
&& coordinatorContext.instanceNum.get() > 0, "Fragment and Instance can not be empty˚");
Expand All @@ -104,6 +107,7 @@ public NereidsCoordinator(Long jobId, TUniqueId queryId, DescriptorTable descTab
this, jobId, queryId, fragments, distributedPlans, scanNodes,
descTable, timezone, loadZeroTolerance, enableProfile
);
this.needEnqueue = false;

Preconditions.checkState(!fragments.isEmpty()
&& coordinatorContext.instanceNum.get() > 0, "Fragment and Instance can not be empty˚");
Expand Down Expand Up @@ -465,7 +469,7 @@ private void setForBroker(

private void enqueue(ConnectContext context) throws UserException {
// LoadTask does not have context, not controlled by queue now
if (context != null && context.getEnv() != null) {
if (context != null && needEnqueue) {
if (Config.enable_workload_group) {
coordinatorContext.setWorkloadGroups(context.getEnv().getWorkloadGroupMgr().getWorkloadGroup(context));
if (shouldQueue(context)) {
Expand Down

0 comments on commit 0351051

Please sign in to comment.