Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.execution;
 
 
 import java.util.List;
 
 import static com.facebook.presto.SystemSessionProperties.isBigQueryEnabled;
 import static com.facebook.presto.execution.SqlTaskExecution.createSqlTaskExecution;
 import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static java.util.Objects.requireNonNull;
 
 public class SqlTaskExecutionFactory
 {
     private static final String VERBOSE_STATS_PROPERTY = "verbose_stats";
     private final Executor taskNotificationExecutor;
 
     private final TaskExecutor taskExecutor;
 
     private final LocalExecutionPlanner planner;
     private final QueryMonitor queryMonitor;
     private final DataSize maxTaskMemoryUsage;
     private final DataSize bigQueryMaxTaskMemoryUsage;
     private final DataSize operatorPreAllocatedMemory;
     private final boolean verboseStats;
     private final boolean cpuTimerEnabled;
 
     public SqlTaskExecutionFactory(
             Executor taskNotificationExecutor,
             TaskExecutor taskExecutor,
             LocalExecutionPlanner planner,
             QueryMonitor queryMonitor,
             TaskManagerConfig config)
     {
         this. = checkNotNull(taskNotificationExecutor"taskNotificationExecutor is null");
         this. = checkNotNull(taskExecutor"taskExecutor is null");
         this. = checkNotNull(planner"planner is null");
         this. = checkNotNull(queryMonitor"queryMonitor is null");
         requireNonNull(config"config is null");
         this. = config.getMaxTaskMemoryUsage();
         this. = config.getBigQueryMaxTaskMemoryUsage();
         this. = config.getOperatorPreAllocatedMemory();
         this. = config.isVerboseStats();
         this. = config.isTaskCpuTimerEnabled();
     }
 
     public SqlTaskExecution create(Session sessionQueryContext queryContextTaskStateMachine taskStateMachineSharedBuffer sharedBufferPlanFragment fragmentList<TaskSourcesources)
     {
         boolean verboseStats = getVerboseStats(session);
         TaskContext taskContext = queryContext.addTaskContext(
                 taskStateMachine,
                 session,
                 isBigQueryEnabled(sessionfalse) ?  : ,
                 checkNotNull("operatorPreAllocatedMemory is null"),
                 verboseStats,
                 );
 
         return createSqlTaskExecution(
                 taskStateMachine,
                 taskContext,
                 sharedBuffer,
                 fragment,
                 sources,
                 ,
                 ,
                 ,
                 );
     }
 
     private boolean getVerboseStats(Session session)
     {
         String verboseStats = session.getSystemProperties().get();
         if (verboseStats == null) {
             return this.;
         }
 
         try {
            return Boolean.valueOf(verboseStats.toUpperCase());
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException("Invalid property '" +  + "=" + verboseStats + "'");
        }
    }
New to GrepCode? Check out our FAQ X