public interface HiveShell
com.klarna.hiverunner.examples.HelloHiveRunner for usage examples.| Modifier and Type | Method and Description |
|---|---|
void |
addResource(String targetFile,
File sourceFile)
Copy test data into hdfs
May only be called pre #start()
|
void |
addResource(String targetFile,
Path sourceFile)
Copy test data into hdfs
May only be called pre #start()
|
void |
addResource(String targetFile,
String data)
Copy test data into hdfs
May only be called pre #start()
|
void |
addSetupScript(String script)
Add a hive script that will be executed when the hive shell is started
Scripts will be executed in the order they are added.
|
void |
addSetupScripts(Charset charset,
File... scripts)
Add hive scripts that will be executed when the hive shell is started.
|
void |
addSetupScripts(Charset charset,
Path... scripts)
Add hive scripts that will be executed when the hive shell is started.
|
void |
addSetupScripts(File... scripts)
Add hive scripts that will be executed when the hive shell is started.
|
void |
addSetupScripts(Path... scripts)
Add hive scripts that will be executed when the hive shell is started.
|
void |
execute(Charset charset,
File file)
Executes a hive script.
|
void |
execute(Charset charset,
Path path)
Executes a hive script.
|
void |
execute(File file)
Executes a hive script.
|
void |
execute(Path path)
Executes a hive script.
|
void |
execute(String script)
Executes a hive script.
|
List<String> |
executeQuery(Charset charset,
File script)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(Charset charset,
File script,
String rowValuesDelimitedBy,
String replaceNullWith)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(Charset charset,
Path script)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(Charset charset,
Path script,
String rowValuesDelimitedBy,
String replaceNullWith)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(File script)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(File script,
String rowValuesDelimitedBy,
String replaceNullWith)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(Path script)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(Path script,
String rowValuesDelimitedBy,
String replaceNullWith)
Executes a single query from a script file, returning any results.
|
List<String> |
executeQuery(String hiveSql)
Executes a single query.
|
List<String> |
executeQuery(String hiveSql,
String rowValuesDelimitedBy,
String replaceNullWith)
Executes a single query.
|
List<Object[]> |
executeStatement(String hiveSql)
Execute a single hive query
|
String |
expandVariableSubstitutes(String expression)
Resolve all substituted variables with the hive conf.
|
Path |
getBaseDir()
Get the test case sand box base dir
|
Path |
getCwd() |
org.apache.hadoop.hive.conf.HiveConf |
getHiveConf()
Get the current HiveConf from hive
|
OutputStream |
getResourceOutputStream(String targetFile)
Open up a stream to write test data into HDFS.
|
InsertIntoTable |
insertInto(String databaseName,
String tableName)
Returns an
InsertIntoTable that allows programmatically inserting data into a table in a fluent manner. |
void |
setCwd(Path cwd) |
void |
setHiveConfValue(String key,
String value)
Set HiveConf property.
|
void |
setHiveVarValue(String var,
String value)
Set Hive variable.
|
void |
setProperty(String key,
String value)
Deprecated.
Use
setHiveConfValue(String, String) instead |
void |
start()
Start the shell.
|
List<String> executeQuery(String hiveSql)
May only be called post #start()
List<String> executeQuery(String hiveSql, String rowValuesDelimitedBy, String replaceNullWith)
May only be called post #start()
List<String> executeQuery(File script)
May only be called post #start()
List<String> executeQuery(Path script)
May only be called post #start()
List<String> executeQuery(Charset charset, File script)
May only be called post #start()
List<String> executeQuery(Charset charset, Path script)
May only be called post #start()
List<String> executeQuery(File script, String rowValuesDelimitedBy, String replaceNullWith)
May only be called post #start()
List<String> executeQuery(Path script, String rowValuesDelimitedBy, String replaceNullWith)
May only be called post #start()
List<String> executeQuery(Charset charset, File script, String rowValuesDelimitedBy, String replaceNullWith)
May only be called post #start()
List<String> executeQuery(Charset charset, Path script, String rowValuesDelimitedBy, String replaceNullWith)
May only be called post #start()
List<Object[]> executeStatement(String hiveSql)
May only be called post #start()
void execute(String script)
May only be called post #start()
void execute(File file)
May only be called post #start()
void execute(Path path)
May only be called post #start()
void execute(Charset charset, File file)
May only be called post #start()
void execute(Charset charset, Path path)
May only be called post #start()
void start()
HiveSQL.autoStart() to false to explicitly control
when to start from the test case.
This might be useful for test methods that needs additional setup not catered for with the provided annotations.
@Deprecated void setProperty(String key, String value)
setHiveConfValue(String, String) insteadMay only be called pre #start()
void setHiveConfValue(String key, String value)
May only be called pre #start()
void setHiveVarValue(String var, String value)
May only be called pre #start()
org.apache.hadoop.hive.conf.HiveConf getHiveConf()
void setCwd(Path cwd)
Path getCwd()
void addResource(String targetFile, File sourceFile)
com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsFileTest()
and com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsStringTest()
void addResource(String targetFile, Path sourceFile)
com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsFileTest()
and com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsStringTest()
void addResource(String targetFile, String data)
com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsFileTest()
and com.klarna.hiverunner.MethodLevelResourceTest#resourceLoadingAsStringTest()
void addSetupScript(String script)
HiveSetupScriptvoid addSetupScripts(Charset charset, File... scripts)
HiveSetupScriptvoid addSetupScripts(Charset charset, Path... scripts)
HiveSetupScriptvoid addSetupScripts(File... scripts)
HiveSetupScriptvoid addSetupScripts(Path... scripts)
HiveSetupScriptPath getBaseDir()
String expandVariableSubstitutes(String expression)
IllegalArgumentException - if not all substitutes could be resolvedIllegalStateException - if the HiveShell was not started yet.OutputStream getResourceOutputStream(String targetFile)
targetFile - The path to the target file relative to the hive work space.
See test class com.klarna.hiverunner.ResourceOutputStreamTest#sequenceFile() for an example of how this works.
with sequence files.InsertIntoTable insertInto(String databaseName, String tableName)
InsertIntoTable that allows programmatically inserting data into a table in a fluent manner.
May only be called post #start()
databaseName - The database nametableName - The table nameCopyright © 2013–2020. All rights reserved.