本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.getId()
方法的一些代码示例,展示了Table.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getId()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:getId
暂无
代码示例来源:origin: apache/hive
this.agentInfo = conn.getAgentInfo();
this.numTxns = conn.getTransactionBatchSize();
this.tableId = conn.getTable().getTTable().getId();
代码示例来源:origin: apache/hive
"INSERT INTO TABLE_PARAMS(TBL_ID, PARAM_KEY)" + " VALUES(" + tbl.getId() + String.format(", '%smykey')", TxnStore.TXN_KEY_START));
client.commitTxnWithKeyValue(1, tbl.getId(), TxnStore.TXN_KEY_START + "mykey", "myvalue");
ValidTxnList validTxns = client.getValidTxns(1);
Assert.assertTrue(validTxns.isTxnValid(1));
+ " FROM TABLE_PARAMS WHERE TBL_ID = " + tbl.getId());
Assert.assertEquals(rs.getLong(1), tbl.getId());
Assert.assertEquals(rs.getString(2), TxnStore.TXN_KEY_START + "mykey");
Assert.assertEquals(rs.getString(3), "myvalue");
client.dropTable(dbName, tblName);
client.dropDatabase(dbName);
stm.execute("DELETE FROM TABLE_PARAMS WHERE TBL_ID = " + tbl.getId() + String.format(
" AND PARAM_KEY = '%smykey'", TxnStore.TXN_KEY_START));
代码示例来源:origin: apache/hive
throw new InvalidObjectException("Id shouldn't be set but table "
+ tbl.getDbName() + "." + tbl.getTableName() + "has the Id set to "
+ tbl.getId() + ". It's a read-only option");
代码示例来源:origin: apache/hive
@Test
public void testCreateAndGetTableWithDriver() throws Exception {
String dbName = "createDb";
String tblName = "createTbl";
client.dropTable(dbName, tblName);
silentDropDatabase(dbName);
new DatabaseBuilder()
.setName(dbName)
.create(client, conf);
createTable(dbName, tblName);
Table tblRead = client.getTable(dbName, tblName);
Assert.assertTrue(tblRead.isSetId());
long firstTableId = tblRead.getId();
createTable(dbName, tblName + "_2");
Table tblRead2 = client.getTable(dbName, tblName + "_2");
Assert.assertTrue(tblRead2.isSetId());
Assert.assertNotEquals(firstTableId, tblRead2.getId());
}
代码示例来源:origin: apache/hive
@Test
public void testTxNWithKeyWrongPrefix() throws Exception {
String dbName = "mydbKeyValueWrongPrefix";
String tblName = "mytable";
List<Long> tids = client.openTxns("me", 1).getTxn_ids();
Assert.assertEquals(1L, (long) tids.get(0));
try {
Database db = new DatabaseBuilder().setName(dbName).build(conf);
db.unsetCatalogName();
client.createDatabase(db);
Table tbl = new TableBuilder().setDbName(dbName).setTableName(tblName)
.addCol("id", "int").addCol("name", "string")
.setType(TableType.MANAGED_TABLE.name()).build(conf);
client.createTable(tbl);
tbl = client.getTable(dbName, tblName);
client.commitTxnWithKeyValue(1, tbl.getId(), "mykey",
"myvalue");
Assert.fail("Should have raised exception");
} catch (IllegalArgumentException e) {
Assert.assertTrue(e.getMessage().contains("key=mykey"));
Assert.assertTrue(e.getMessage().contains("value=myvalue"));
Assert.assertTrue(e.getMessage().contains("key should start with"));
} finally {
client.dropTable(dbName, tblName);
client.dropDatabase(dbName);
}
ValidTxnList validTxns = client.getValidTxns(1);
Assert.assertTrue(validTxns.isTxnValid(1));
}
代码示例来源:origin: apache/hive
public Object getFieldValue(_Fields field) {
switch (field) {
case ID:
return getId();
内容来源于网络,如有侵权,请联系作者删除!