public final class InsertIntoTable extends Object
| Modifier and Type | Method and Description |
|---|---|
InsertIntoTable |
addRow(Object... values)
Flushes the current row and creates a new row with the values specified.
|
InsertIntoTable |
addRowsFrom(File file,
FileParser fileParser)
Adds all rows from the file specified, using the provided parser.
|
InsertIntoTable |
addRowsFromDelimited(File file,
String delimiter,
Object nullValue)
Adds all rows from the TSV file specified, using the provided delimiter and null value.
|
InsertIntoTable |
addRowsFromTsv(File file)
Adds all rows from the TSV file specified.
|
void |
commit()
Inserts the data into the table.
|
InsertIntoTable |
copyRow()
Flushes the current row and creates a new row with the same values.
|
static InsertIntoTable |
newInstance(String databaseName,
String tableName,
org.apache.hadoop.hive.conf.HiveConf conf)
Factory method for creating an
InsertIntoTable. |
InsertIntoTable |
newRow()
Flushes the current row and creates a new row with
null values for all columns. |
InsertIntoTable |
set(String name,
Object value)
Set the given column name to the given value.
|
InsertIntoTable |
setRow(Object... values)
Sets the current row with the values specified.
|
InsertIntoTable |
withAllColumns()
Resets the column name mask to all the columns in the table.
|
InsertIntoTable |
withColumns(String... names)
Defines a subset of columns (a column name mask) so that only pertinent columns can be set.
|
public static InsertIntoTable newInstance(String databaseName, String tableName, org.apache.hadoop.hive.conf.HiveConf conf)
InsertIntoTable.
This method is intended to be called via HiveShell.insertInto(String, String).
databaseName - The database name.tableName - The table name.conf - The HiveConf.public InsertIntoTable withColumns(String... names)
e.g.
tableDataBuilder
.withColumns("col1", "col3")
.addRow("value1", "value3")
names - The column names.thisIllegalArgumentException - if a column name does not exist in the table.public InsertIntoTable withAllColumns()
thispublic InsertIntoTable newRow()
null values for all columns.thispublic InsertIntoTable addRow(Object... values)
values - The values to set.thispublic InsertIntoTable setRow(Object... values)
values - The values to set.thispublic InsertIntoTable addRowsFromTsv(File file)
file - The file to read the data from.thispublic InsertIntoTable addRowsFromDelimited(File file, String delimiter, Object nullValue)
file - The file to read the data from.delimiter - A column delimiter.nullValue - Value to be treated as null in the source data.thispublic InsertIntoTable addRowsFrom(File file, FileParser fileParser)
file - File to read the data from.fileParser - Parser to be used to parse the file.thispublic InsertIntoTable copyRow()
thispublic InsertIntoTable set(String name, Object value)
name - The column name to set.value - the value to set.thisIllegalArgumentException - if a column name does not exist in the table.public void commit()
Copyright © 2013–2020. All rights reserved.