org.apache.hadoop.hive.ql.exec
Class Task<T extends Serializable>

java.lang.Object
  extended by org.apache.hadoop.hive.ql.exec.Task<T>
All Implemented Interfaces:
Serializable, Node
Direct Known Subclasses:
BlockMergeTask, ColumnStatsTask, ColumnTruncateTask, ConditionalTask, CopyTask, DDLTask, DependencyCollectionTask, ExecDriver, ExplainTask, FetchTask, FunctionTask, IndexMetadataChangeTask, MapredLocalTask, MoveTask, PartialScanTask, StatsNoJobTask, StatsTask, TezTask

public abstract class Task<T extends Serializable>
extends Object
implements Serializable, Node

Task implementation.

See Also:
Serialized Form

Nested Class Summary
static class Task.FeedType
           
 
Field Summary
static int BACKUP_COMMON_JOIN
           
static int COMMON_JOIN
           
static int CONVERTED_MAPJOIN
           
static int CONVERTED_MAPJOIN_LOCAL
           
static int CONVERTED_SORTMERGEJOIN
           
static int HINTED_MAPJOIN
           
static int HINTED_MAPJOIN_LOCAL
           
static int MAPJOIN_ONLY_NOBACKUP
           
static int NO_TAG
           
 HashMap<String,Long> taskCounters
           
 TaskHandle taskHandle
           
 
Constructor Summary
Task()
           
 
Method Summary
 boolean addDependentTask(Task<? extends Serializable> dependent)
          Add a dependent task on the current task.
 boolean done()
           
 boolean equals(Object obj)
           
 int executeTask()
          This method is called in the Driver on every task.
 Task<? extends Serializable> getAndInitBackupTask()
           
 List<Task<? extends Serializable>> getBackupChildrenTasks()
           
 Task<? extends Serializable> getBackupTask()
           
 List<? extends Node> getChildren()
          Gets the vector of children nodes.
 List<Task<? extends Serializable>> getChildTasks()
           
 HashMap<String,Long> getCounters()
           
 List<Task<? extends Serializable>> getDependentTasks()
          The default dependent tasks are just child tasks, but different types could implement their own (e.g.
 DriverContext getDriverContext()
           
 List<Task<? extends Serializable>> getFeedSubscribers()
           
 String getId()
           
 boolean getInitialized()
           
 String getJobID()
           
 List<Task<? extends Serializable>> getParentTasks()
           
 QueryPlan getQueryPlan()
           
 boolean getQueued()
           
 Operator<? extends OperatorDesc> getReducer()
           
 List<org.apache.hadoop.hive.metastore.api.FieldSchema> getResultSchema()
           
 TaskHandle getTaskHandle()
           
 int getTaskTag()
           
 Collection<Operator<? extends OperatorDesc>> getTopOperators()
           
abstract  org.apache.hadoop.hive.ql.plan.api.StageType getType()
          Should be overridden to return the type of the specific task among the types in StageType.
 T getWork()
           
 int hashCode()
           
 boolean hasReduce()
           
 boolean ifRetryCmdWhenFail()
           
 void initialize(HiveConf conf, QueryPlan queryPlan, DriverContext driverContext)
           
 boolean isLocalMode()
           
 boolean isMapRedLocalTask()
           
 boolean isMapRedTask()
           
 boolean isRootTask()
           
 boolean isRunnable()
           
 void removeDependentTask(Task<? extends Serializable> dependent)
          Remove the dependent task.
 void removeFromChildrenTasks()
           
 boolean requireLock()
           
 void setBackupChildrenTasks(List<Task<? extends Serializable>> backupChildrenTasks)
           
 void setBackupTask(Task<? extends Serializable> backupTask)
           
 void setChildTasks(List<Task<? extends Serializable>> childTasks)
           
 void setConsole(SessionState.LogHelper console)
           
 void setDone()
           
 void setFeedSubscribers(List<Task<? extends Serializable>> s)
           
 void setId(String id)
           
 void setInitialized()
           
 void setLocalMode(boolean isLocalMode)
           
 void setParentTasks(List<Task<? extends Serializable>> parentTasks)
           
 void setQueryPlan(QueryPlan queryPlan)
           
 void setQueued()
           
 void setRetryCmdWhenFail(boolean retryCmdWhenFail)
           
 void setRootTask(boolean rootTask)
           
 void setStarted()
           
 void setTaskTag(int taskTag)
           
 void setWork(T work)
           
 void shutdown()
           
 boolean started()
           
 void subscribeFeed(Task<? extends Serializable> publisher)
          Subscribe the feed of publisher.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hive.ql.lib.Node
getName
 

Field Detail

taskCounters

public transient HashMap<String,Long> taskCounters

taskHandle

public transient TaskHandle taskHandle

NO_TAG

public static final int NO_TAG
See Also:
Constant Field Values

COMMON_JOIN

public static final int COMMON_JOIN
See Also:
Constant Field Values

HINTED_MAPJOIN

public static final int HINTED_MAPJOIN
See Also:
Constant Field Values

HINTED_MAPJOIN_LOCAL

public static final int HINTED_MAPJOIN_LOCAL
See Also:
Constant Field Values

CONVERTED_MAPJOIN

public static final int CONVERTED_MAPJOIN
See Also:
Constant Field Values

CONVERTED_MAPJOIN_LOCAL

public static final int CONVERTED_MAPJOIN_LOCAL
See Also:
Constant Field Values

BACKUP_COMMON_JOIN

public static final int BACKUP_COMMON_JOIN
See Also:
Constant Field Values

MAPJOIN_ONLY_NOBACKUP

public static final int MAPJOIN_ONLY_NOBACKUP
See Also:
Constant Field Values

CONVERTED_SORTMERGEJOIN

public static final int CONVERTED_SORTMERGEJOIN
See Also:
Constant Field Values
Constructor Detail

Task

public Task()
Method Detail

getTaskHandle

public TaskHandle getTaskHandle()

initialize

public void initialize(HiveConf conf,
                       QueryPlan queryPlan,
                       DriverContext driverContext)

executeTask

public int executeTask()
This method is called in the Driver on every task. It updates counters and calls execute(), which is overridden in each task

Returns:
return value of execute()

isRootTask

public boolean isRootTask()

setRootTask

public void setRootTask(boolean rootTask)

setChildTasks

public void setChildTasks(List<Task<? extends Serializable>> childTasks)

getChildren

public List<? extends Node> getChildren()
Description copied from interface: Node
Gets the vector of children nodes. This is used in the graph walker algorithms.

Specified by:
getChildren in interface Node
Returns:
List

getChildTasks

public List<Task<? extends Serializable>> getChildTasks()

setParentTasks

public void setParentTasks(List<Task<? extends Serializable>> parentTasks)

getParentTasks

public List<Task<? extends Serializable>> getParentTasks()

getBackupTask

public Task<? extends Serializable> getBackupTask()

setBackupTask

public void setBackupTask(Task<? extends Serializable> backupTask)

getBackupChildrenTasks

public List<Task<? extends Serializable>> getBackupChildrenTasks()

setBackupChildrenTasks

public void setBackupChildrenTasks(List<Task<? extends Serializable>> backupChildrenTasks)

getAndInitBackupTask

public Task<? extends Serializable> getAndInitBackupTask()

removeFromChildrenTasks

public void removeFromChildrenTasks()

getDependentTasks

public List<Task<? extends Serializable>> getDependentTasks()
The default dependent tasks are just child tasks, but different types could implement their own (e.g. ConditionalTask will use the listTasks as dependents).

Returns:
a list of tasks that are dependent on this task.

addDependentTask

public boolean addDependentTask(Task<? extends Serializable> dependent)
Add a dependent task on the current task. Return if the dependency already existed or is this a new one

Returns:
true if the task got added false if it already existed

removeDependentTask

public void removeDependentTask(Task<? extends Serializable> dependent)
Remove the dependent task.

Parameters:
dependent - the task to remove

setStarted

public void setStarted()

started

public boolean started()

done

public boolean done()

setDone

public void setDone()

setQueued

public void setQueued()

getQueued

public boolean getQueued()

setInitialized

public void setInitialized()

getInitialized

public boolean getInitialized()

isRunnable

public boolean isRunnable()

getDriverContext

public DriverContext getDriverContext()

setWork

public void setWork(T work)

getWork

public T getWork()

setId

public void setId(String id)

getId

public String getId()

isMapRedTask

public boolean isMapRedTask()

isMapRedLocalTask

public boolean isMapRedLocalTask()

getTopOperators

public Collection<Operator<? extends OperatorDesc>> getTopOperators()

hasReduce

public boolean hasReduce()

getReducer

public Operator<? extends OperatorDesc> getReducer()

getCounters

public HashMap<String,Long> getCounters()

getType

public abstract org.apache.hadoop.hive.ql.plan.api.StageType getType()
Should be overridden to return the type of the specific task among the types in StageType.

Returns:
StageType.* or null if not overridden

subscribeFeed

public void subscribeFeed(Task<? extends Serializable> publisher)
Subscribe the feed of publisher. To prevent cycles, a task can only subscribe to its ancestor. Feed is a generic form of execution-time feedback (type, value) pair from one task to another task. Examples include dynamic partitions (which are only available at execution time). The MoveTask may pass the list of dynamic partitions to the StatsTask since after the MoveTask the list of dynamic partitions are lost (MoveTask moves them to the table's destination directory which is mixed with old partitions).

Parameters:
publisher - this feed provider.

getFeedSubscribers

public List<Task<? extends Serializable>> getFeedSubscribers()

setFeedSubscribers

public void setFeedSubscribers(List<Task<? extends Serializable>> s)

getTaskTag

public int getTaskTag()

setTaskTag

public void setTaskTag(int taskTag)

isLocalMode

public boolean isLocalMode()

setLocalMode

public void setLocalMode(boolean isLocalMode)

requireLock

public boolean requireLock()

ifRetryCmdWhenFail

public boolean ifRetryCmdWhenFail()

setRetryCmdWhenFail

public void setRetryCmdWhenFail(boolean retryCmdWhenFail)

getQueryPlan

public QueryPlan getQueryPlan()

setQueryPlan

public void setQueryPlan(QueryPlan queryPlan)

getJobID

public String getJobID()

shutdown

public void shutdown()

getResultSchema

public List<org.apache.hadoop.hive.metastore.api.FieldSchema> getResultSchema()

setConsole

public void setConsole(SessionState.LogHelper console)

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2014 The Apache Software Foundation. All rights reserved.