org.apache.hadoop.hive.ql
Class Driver

java.lang.Object
  extended by org.apache.hadoop.hive.ql.Driver
All Implemented Interfaces:
CommandProcessor

public class Driver
extends Object
implements CommandProcessor


Constructor Summary
Driver()
           
Driver(HiveConf conf)
          for backwards compatibility with current tests
Driver(HiveConf conf, String userName)
           
 
Method Summary
 int close()
           
 int compile(String command)
          Compile a new query.
 int compile(String command, boolean resetTaskIds)
          Compile a new query, but potentially reset taskID counter.
 CommandProcessorResponse compileAndRespond(String command)
           
 void destroy()
           
 int execute()
           
 org.apache.hadoop.mapred.ClusterStatus getClusterStatus()
          Return the status information about the Map-Reduce cluster
 String getErrorMsg()
           
 int getMaxRows()
          Return the maximum number of rows returned by getResults
 QueryPlan getPlan()
           
 org.apache.hadoop.hive.ql.plan.api.Query getQueryPlan()
           
 boolean getResults(List res)
           
 org.apache.hadoop.hive.metastore.api.Schema getSchema()
           
static org.apache.hadoop.hive.metastore.api.Schema getSchema(BaseSemanticAnalyzer sem, HiveConf conf)
          Get a Schema with fields represented with native Hive types
 org.apache.hadoop.hive.metastore.api.Schema getThriftSchema()
          Get a Schema with fields represented with Thrift DDL types
 int getTryCount()
           
 boolean hasReduceTasks(List<Task<? extends Serializable>> tasks)
           
 void init()
           
 boolean isFetchingTable()
           
 void resetFetch()
           
 void restoreSession(org.apache.hadoop.hive.ql.Driver.QueryState qs)
           
 CommandProcessorResponse run()
           
 CommandProcessorResponse run(String command)
           
 CommandProcessorResponse run(String command, boolean alreadyCompiled)
           
 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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Driver

public Driver(HiveConf conf)
for backwards compatibility with current tests


Driver

public Driver(HiveConf conf,
              String userName)

Driver

public Driver()
Method Detail

init

public void init()
Specified by:
init in interface CommandProcessor

getClusterStatus

public org.apache.hadoop.mapred.ClusterStatus getClusterStatus()
                                                        throws Exception
Return the status information about the Map-Reduce cluster

Throws:
Exception

getSchema

public org.apache.hadoop.hive.metastore.api.Schema getSchema()

getSchema

public static org.apache.hadoop.hive.metastore.api.Schema getSchema(BaseSemanticAnalyzer sem,
                                                                    HiveConf conf)
Get a Schema with fields represented with native Hive types


getThriftSchema

public org.apache.hadoop.hive.metastore.api.Schema getThriftSchema()
                                                            throws Exception
Get a Schema with fields represented with Thrift DDL types

Throws:
Exception

getMaxRows

public int getMaxRows()
Return the maximum number of rows returned by getResults


setMaxRows

public void setMaxRows(int maxRows)
Set the maximum number of rows returned by getResults


hasReduceTasks

public boolean hasReduceTasks(List<Task<? extends Serializable>> tasks)

compile

public int compile(String command)
Compile a new query. Any currently-planned query associated with this Driver is discarded. Do not reset id for inner queries(index, etc). Task ids are used for task identity check.

Parameters:
command - The SQL query to compile.

saveSession

public void saveSession(org.apache.hadoop.hive.ql.Driver.QueryState qs)

restoreSession

public void restoreSession(org.apache.hadoop.hive.ql.Driver.QueryState qs)

compile

public int compile(String command,
                   boolean resetTaskIds)
Compile a new query, but potentially reset taskID counter. Not resetting task counter is useful for generating re-entrant QL queries.

Parameters:
command - The HiveQL query to compile
resetTaskIds - Resets taskID counter if true.
Returns:
0 for ok

getPlan

public QueryPlan getPlan()
Returns:
The current query plan associated with this Driver, if any.

run

public CommandProcessorResponse run(String command)
                             throws CommandNeedRetryException
Specified by:
run in interface CommandProcessor
Throws:
CommandNeedRetryException

run

public CommandProcessorResponse run()
                             throws CommandNeedRetryException
Throws:
CommandNeedRetryException

run

public CommandProcessorResponse run(String command,
                                    boolean alreadyCompiled)
                             throws CommandNeedRetryException
Throws:
CommandNeedRetryException

compileAndRespond

public CommandProcessorResponse compileAndRespond(String command)

execute

public int execute()
            throws CommandNeedRetryException
Throws:
CommandNeedRetryException

isFetchingTable

public boolean isFetchingTable()

getResults

public boolean getResults(List res)
                   throws IOException,
                          CommandNeedRetryException
Throws:
IOException
CommandNeedRetryException

resetFetch

public void resetFetch()
                throws IOException
Throws:
IOException

getTryCount

public int getTryCount()

setTryCount

public void setTryCount(int tryCount)

close

public int close()

destroy

public void destroy()

getQueryPlan

public org.apache.hadoop.hive.ql.plan.api.Query getQueryPlan()
                                                      throws IOException
Throws:
IOException

getErrorMsg

public String getErrorMsg()


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