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;
 
 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(
                 taskNotificationExecutor,
                 taskExecutor,
                 planner,
                 queryMonitor,
                 config.getMaxTaskMemoryUsage(),
                 config.getBigQueryMaxTaskMemoryUsage(),
                 config.getOperatorPreAllocatedMemory(),
                 config.isVerboseStats(),
                 config.isTaskCpuTimerEnabled());
     }
 
     public SqlTaskExecutionFactory(
             Executor taskNotificationExecutor,
             TaskExecutor taskExecutor,
             LocalExecutionPlanner planner,
             QueryMonitor queryMonitor,
             DataSize maxTaskMemoryUsage,
             DataSize bigQueryMaxTaskMemoryUsage,
             DataSize operatorPreAllocatedMemory,
             boolean verboseStats,
             boolean cpuTimerEnabled)
     {
         this. = checkNotNull(taskNotificationExecutor"taskNotificationExecutor is null");
         this. = checkNotNull(taskExecutor"taskExecutor is null");
         this. = checkNotNull(planner"planner is null");
         this. = checkNotNull(queryMonitor"queryMonitor is null");
         this. = checkNotNull(maxTaskMemoryUsage"maxTaskMemoryUsage is null");
         this. = checkNotNull(bigQueryMaxTaskMemoryUsage"bigQueryMaxTaskMemoryUsage is null");
         this. = checkNotNull(operatorPreAllocatedMemory"operatorPreAllocatedMemory is null");
         this. = verboseStats;
         this. = cpuTimerEnabled;
     }
 
     public SqlTaskExecution create(Session sessionTaskStateMachine taskStateMachineSharedBuffer sharedBufferPlanFragment fragmentList<TaskSourcesources)
     {
         boolean verboseStats = getVerboseStats(session);
         TaskContext taskContext = new TaskContext(
                 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