public class Driver extends java.lang.Object implements CommandProcessor
Modifier and Type | Field and Description |
---|---|
protected int |
tryCount |
Constructor and Description |
---|
Driver() |
Driver(HiveConf conf)
for backwards compatibility with current tests
|
Modifier and Type | Method and Description |
---|---|
int |
acquireReadWriteLocks()
Acquire read and write locks needed by the statement.
|
int |
close() |
int |
compile(java.lang.String command)
Compile a new query.
|
int |
compile(java.lang.String command,
boolean resetTaskIds)
Compile a new query, but potentially reset taskID counter.
|
void |
destroy() |
int |
execute() |
ClusterStatus |
getClusterStatus()
Return the status information about the Map-Reduce cluster
|
int |
getMaxRows()
Return the maximum number of rows returned by getResults
|
QueryPlan |
getPlan() |
Query |
getQueryPlan() |
boolean |
getResults(java.util.ArrayList<java.lang.String> res) |
Schema |
getSchema() |
static Schema |
getSchema(BaseSemanticAnalyzer sem,
HiveConf conf)
Get a Schema with fields represented with native Hive types
|
Schema |
getThriftSchema()
Get a Schema with fields represented with Thrift DDL types
|
int |
getTryCount() |
boolean |
hasReduceTasks(java.util.List<Task<? extends java.io.Serializable>> tasks) |
void |
init() |
void |
launchTask(Task<? extends java.io.Serializable> tsk,
java.lang.String queryId,
boolean noName,
java.util.Map<TaskResult,TaskRunner> running,
java.lang.String jobname,
int jobs,
DriverContext cxt)
Launches a new task
|
TaskResult |
pollTasks(java.util.Set<TaskResult> results)
Polls running tasks to see if a task has ended.
|
void |
restoreSession(org.apache.hadoop.hive.ql.Driver.QueryState qs) |
CommandProcessorResponse |
run(java.lang.String command) |
void |
saveSession(org.apache.hadoop.hive.ql.Driver.QueryState qs) |
void |
setMaxRows(int maxRows)
Set the maximum number of rows returned by getResults
|
void |
setTryCount(int tryCount) |
void |
taskCleanup(java.util.Map<TaskResult,TaskRunner> running)
Cleans up remaining tasks in case of failure
|
public Driver(HiveConf conf)
public Driver()
public void init()
init
in interface CommandProcessor
public ClusterStatus getClusterStatus() throws java.lang.Exception
java.lang.Exception
public Schema getSchema()
public static Schema getSchema(BaseSemanticAnalyzer sem, HiveConf conf)
public Schema getThriftSchema() throws java.lang.Exception
java.lang.Exception
public int getMaxRows()
public void setMaxRows(int maxRows)
public boolean hasReduceTasks(java.util.List<Task<? extends java.io.Serializable>> tasks)
public int compile(java.lang.String command)
command
- The SQL query to compile.public void saveSession(org.apache.hadoop.hive.ql.Driver.QueryState qs)
public void restoreSession(org.apache.hadoop.hive.ql.Driver.QueryState qs)
public int compile(java.lang.String command, boolean resetTaskIds)
command
- The HiveQL query to compileresetTaskIds
- Resets taskID counter if true.public QueryPlan getPlan()
public int acquireReadWriteLocks()
public CommandProcessorResponse run(java.lang.String command) throws CommandNeedRetryException
run
in interface CommandProcessor
CommandNeedRetryException
public int execute() throws CommandNeedRetryException
CommandNeedRetryException
public void launchTask(Task<? extends java.io.Serializable> tsk, java.lang.String queryId, boolean noName, java.util.Map<TaskResult,TaskRunner> running, java.lang.String jobname, int jobs, DriverContext cxt)
tsk
- task being launchedqueryId
- Id of the query containing the tasknoName
- whether the task has a name setrunning
- map from taskresults to taskrunnersjobname
- name of the task, if it is a map-reduce jobjobs
- number of map-reduce jobscxt
- the driver contextpublic void taskCleanup(java.util.Map<TaskResult,TaskRunner> running)
public TaskResult pollTasks(java.util.Set<TaskResult> results)
results
- Set of result objects for running taskspublic boolean getResults(java.util.ArrayList<java.lang.String> res) throws java.io.IOException, CommandNeedRetryException
java.io.IOException
CommandNeedRetryException
public int getTryCount()
public void setTryCount(int tryCount)
public int close()
public void destroy()
public Query getQueryPlan() throws java.io.IOException
java.io.IOException
Copyright © 2012 The Apache Software Foundation