use of org.apache.hadoop.hive.metastore.client.builder.TableBuilder in project hive by apache.
the class TestHiveMetaStore method createTable.
/**
* Creates a simple table under specified database
* @param dbName the database name that the table will be created under
* @param tableName the table name to be created
*/
private void createTable(String dbName, String tableName) throws TException {
Table t = new TableBuilder().setDbName(dbName).setTableName(tableName).addCol("foo", "string").addCol("bar", "string").build();
client.createTable(t);
}
use of org.apache.hadoop.hive.metastore.client.builder.TableBuilder in project hive by apache.
the class TestAddPartitions method createExternalTable.
private void createExternalTable(String tableName, String location) throws Exception {
Table table = new TableBuilder().setDbName(DB_NAME).setTableName(tableName).addCol("test_id", "int", "test col id").addCol("test_value", DEFAULT_COL_TYPE, "test col value").addPartCol(YEAR_COL_NAME, DEFAULT_COL_TYPE).addTableParam("EXTERNAL", "TRUE").setLocation(location).build();
client.createTable(table);
}
use of org.apache.hadoop.hive.metastore.client.builder.TableBuilder in project hive by apache.
the class TestAddPartitionsFromPartSpec method createTable.
private Table createTable(String dbName, String tableName, List<FieldSchema> partCols, String location) throws Exception {
Table table = new TableBuilder().setDbName(dbName).setTableName(tableName).addCol("test_id", "int", "test col id").addCol("test_value", "string", "test col value").addTableParam("partTestTableParamKey", "partTestTableParamValue").setPartCols(partCols).addStorageDescriptorParam("partTestSDParamKey", "partTestSDParamValue").setSerdeName(tableName).setStoredAsSubDirectories(false).addSerdeParam("partTestSerdeParamKey", "partTestSerdeParamValue").setLocation(location).build();
client.createTable(table);
return client.getTable(dbName, tableName);
}
use of org.apache.hadoop.hive.metastore.client.builder.TableBuilder in project hive by apache.
the class TestAppendPartitions method createTable.
private Table createTable(String tableName, List<FieldSchema> partCols, Map<String, String> tableParams, String tableType, String location) throws Exception {
Table table = new TableBuilder().setDbName(DB_NAME).setTableName(tableName).addCol("test_id", "int", "test col id").addCol("test_value", "string", "test col value").setPartCols(partCols).setTableParams(tableParams).setType(tableType).setLocation(location).build();
client.createTable(table);
return client.getTable(DB_NAME, tableName);
}
use of org.apache.hadoop.hive.metastore.client.builder.TableBuilder in project hive by apache.
the class TestSessionHiveMetastoreClientAlterPartitionsTempTable method createTestTable.
@Override
protected Table createTestTable(IMetaStoreClient client, String dbName, String tableName, List<String> partCols, boolean setPartitionLevelPrivilages) throws Exception {
TableBuilder builder = new TableBuilder().setDbName(dbName).setTableName(tableName).addCol("id", "int").addCol("name", "string").setTemporary(true);
partCols.forEach(col -> builder.addPartCol(col, "string"));
Table table = builder.build(getMetaStore().getConf());
if (setPartitionLevelPrivilages) {
table.putToParameters(PART_PRIV, "true");
}
client.createTable(table);
return table;
}
Aggregations