org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable()方法的一些代码示例,展示了Table.getEmptyTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getEmptyTable()方法的具体详情如下:
包路径:org.apache.hadoop.hive.ql.metadata.Table
类名称:Table
方法名:getEmptyTable

Table.getEmptyTable介绍

[英]Initialize an empty table.
[中]初始化空表。

代码示例

代码示例来源:origin: apache/hive

public Table(String databaseName, String tableName) {
 this(getEmptyTable(databaseName, tableName));
}

代码示例来源:origin: apache/drill

public Table(String databaseName, String tableName) {
 this(getEmptyTable(databaseName, tableName));
}

代码示例来源:origin: apache/incubator-gobblin

public Table createTestAvroTable(String dbName, String tableName, String tableSdLoc,
  Optional<String> partitionFieldName, boolean ignoreDbCreation) throws Exception {
 if (!ignoreDbCreation) {
  createTestDb(dbName);
 }
 Table tbl = org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable(dbName, tableName);
 tbl.getSd().setLocation(tableSdLoc);
 tbl.getSd().getSerdeInfo().setSerializationLib(AvroSerDe.class.getName());
 tbl.getSd().getSerdeInfo().setParameters(ImmutableMap.of(HiveAvroSerDeManager.SCHEMA_URL, "/tmp/dummy"));
 if (partitionFieldName.isPresent()) {
  tbl.addToPartitionKeys(new FieldSchema(partitionFieldName.get(), "string", "some comment"));
 }
 this.localMetastoreClient.createTable(tbl);
 return tbl;
}

代码示例来源:origin: apache/incubator-gobblin

public Table createTestAvroTable(String dbName, String tableName, String tableSdLoc,
  List<String> partitionFieldNames, boolean ignoreDbCreation)
  throws Exception {
 if (!ignoreDbCreation) {
  createTestDb(dbName);
 }
 Table tbl = org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable(dbName, tableName);
 tbl.getSd().setLocation(tableSdLoc);
 tbl.getSd().getSerdeInfo().setParameters(ImmutableMap.of(HiveAvroSerDeManager.SCHEMA_URL, "/tmp/dummy"));
 for (String partitionFieldName : partitionFieldNames) {
  tbl.addToPartitionKeys(new FieldSchema(partitionFieldName, "string", "some comment"));
 }
 this.localMetastoreClient.createTable(tbl);
 return tbl;
}

代码示例来源:origin: apache/hive

/**
 * This test tests that a plain table instantiation matches what hive says an
 * empty table create should look like.
 * @throws Exception
 */
@Test
public void testEmptyTableInstantiation() throws Exception {
 HCatClient client = HCatClient.create(new Configuration(hcatConf));
 String dbName = "default";
 String tblName = "testEmptyCreate";
 ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
 cols.add(new HCatFieldSchema("id", Type.INT, "id comment"));
 cols.add(new HCatFieldSchema("value", Type.STRING, "value comment"));
 client.dropTable(dbName, tblName, true);
 // Create a minimalistic table
 client.createTable(HCatCreateTableDesc
   .create(new HCatTable(dbName, tblName).cols(cols), false)
   .build());
 HCatTable tCreated = client.getTable(dbName, tblName);
 org.apache.hadoop.hive.metastore.api.Table emptyTable = Table.getEmptyTable(dbName, tblName);
 Map<String, String> createdProps = tCreated.getTblProps();
 Map<String, String> emptyProps = emptyTable.getParameters();
 mapEqualsContainedIn(emptyProps, createdProps);
 // Test sd params - we check that all the parameters in an empty table
 // are retained as-is. We may add beyond it, but not change values for
 // any parameters that hive defines for an empty table.
 Map<String, String> createdSdParams = tCreated.getSerdeParams();
 Map<String, String> emptySdParams = emptyTable.getSd().getSerdeInfo().getParameters();
 mapEqualsContainedIn(emptySdParams, createdSdParams);
}

代码示例来源:origin: org.apache.hadoop.hive/hive-exec

public Table(String databaseName, String tableName) {
 this(getEmptyTable(databaseName, tableName));
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

public Table(String databaseName, String tableName) {
 this(getEmptyTable(databaseName, tableName));
}

相关文章

微信公众号

最新文章

更多

Table类方法