org.apache.hadoop.hive.metastore.api.Table.<init>()方法的使用及代码示例

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

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

Table.<init>介绍

[英]Performs a deep copy on other.
[中]在其他计算机上执行深度复制。

代码示例

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

  1. protected Table deepCopy(Table table) {
  2. Table copy = null;
  3. if (table != null) {
  4. copy = new Table(table);
  5. }
  6. return copy;
  7. }

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

  1. public Table deepCopy() {
  2. return new Table(this);
  3. }

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

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public GetTablesResult(GetTablesResult other) {
  5. if (other.isSetTables()) {
  6. List<Table> __this__tables = new ArrayList<Table>(other.tables.size());
  7. for (Table other_element : other.tables) {
  8. __this__tables.add(new Table(other_element));
  9. }
  10. this.tables = __this__tables;
  11. }
  12. }

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

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public GetTableResult(GetTableResult other) {
  5. __isset_bitfield = other.__isset_bitfield;
  6. if (other.isSetTable()) {
  7. this.table = new Table(other.table);
  8. }
  9. this.isStatsCompliant = other.isStatsCompliant;
  10. }

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

  1. protected Table deepCopy(Table table) {
  2. Table copy = null;
  3. if (table != null) {
  4. copy = new Table(table);
  5. }
  6. return copy;
  7. }

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

  1. private Table table() throws TException {
  2. return deserialize(new Table(), tableDesc);
  3. }

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

  1. public static Table getTableObj(ObjectNode jsonTree) throws Exception {
  2. TDeserializer deSerializer = new TDeserializer(new TJSONProtocol.Factory());
  3. Table tableObj = new Table();
  4. String tableJson = jsonTree.get("tableObjJson").asText();
  5. deSerializer.deserialize(tableObj, tableJson, "UTF-8");
  6. return tableObj;
  7. }

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

  1. private void addTable(String databaseName, String tableName, Set<Table> tables) {
  2. checkNotNullOrEmpty(databaseName);
  3. checkNotNullOrEmpty(tableName);
  4. Table table = new Table();
  5. table.setDbName(databaseName);
  6. table.setTableName(tableName);
  7. tables.add(table);
  8. }

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

  1. @Override
  2. public HCatTable deserializeTable(String hcatTableStringRep) throws HCatException {
  3. try {
  4. Table table = new Table();
  5. new TDeserializer(new TJSONProtocol.Factory()).deserialize(table, hcatTableStringRep, "UTF-8");
  6. return new HCatTable(table);
  7. }
  8. catch(TException exception) {
  9. if (LOG.isDebugEnabled())
  10. LOG.debug("Could not de-serialize from: " + hcatTableStringRep);
  11. throw new HCatException("Could not de-serialize HCatTable.", exception);
  12. }
  13. }

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

  1. @Override
  2. public void read(org.apache.thrift.protocol.TProtocol prot, GetTableResult struct) throws org.apache.thrift.TException {
  3. TTupleProtocol iprot = (TTupleProtocol) prot;
  4. struct.table = new Table();
  5. struct.table.read(iprot);
  6. struct.setTableIsSet(true);
  7. BitSet incoming = iprot.readBitSet(1);
  8. if (incoming.get(0)) {
  9. struct.isStatsCompliant = iprot.readBool();
  10. struct.setIsStatsCompliantIsSet(true);
  11. }
  12. }
  13. }

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

  1. private static List<Table> createTable() {
  2. Table table = new Table();
  3. table.setDbName("DB");
  4. table.setTableName("TABLE");
  5. return Arrays.asList(table);
  6. }
  7. }

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

  1. private static Table createTable(String databaseName, String tableName) {
  2. Table table = new Table();
  3. table.setDbName(databaseName);
  4. table.setTableName(tableName);
  5. return table;
  6. }

代码示例来源:origin: prestodb/presto

  1. @Override
  2. public Table getTable(String dbName, String tableName)
  3. throws TException
  4. {
  5. accessCount.incrementAndGet();
  6. if (throwException) {
  7. throw new RuntimeException();
  8. }
  9. if (!dbName.equals(TEST_DATABASE) || !tableName.equals(TEST_TABLE)) {
  10. throw new NoSuchObjectException();
  11. }
  12. return new Table(
  13. TEST_TABLE,
  14. TEST_DATABASE,
  15. "",
  16. 0,
  17. 0,
  18. 0,
  19. DEFAULT_STORAGE_DESCRIPTOR,
  20. ImmutableList.of(new FieldSchema("key", "string", null)),
  21. null,
  22. "",
  23. "",
  24. TableType.MANAGED_TABLE.name());
  25. }

代码示例来源:origin: prestodb/presto

  1. public static org.apache.hadoop.hive.metastore.api.Table toMetastoreApiTable(Table table, PrincipalPrivileges privileges)
  2. {
  3. org.apache.hadoop.hive.metastore.api.Table result = new org.apache.hadoop.hive.metastore.api.Table();
  4. result.setDbName(table.getDatabaseName());
  5. result.setTableName(table.getTableName());
  6. result.setOwner(table.getOwner());
  7. result.setTableType(table.getTableType());
  8. result.setParameters(table.getParameters());
  9. result.setPartitionKeys(table.getPartitionColumns().stream().map(ThriftMetastoreUtil::toMetastoreApiFieldSchema).collect(toList()));
  10. result.setSd(makeStorageDescriptor(table.getTableName(), table.getDataColumns(), table.getStorage()));
  11. result.setPrivileges(toMetastoreApiPrincipalPrivilegeSet(table.getOwner(), privileges));
  12. result.setViewOriginalText(table.getViewOriginalText().orElse(null));
  13. result.setViewExpandedText(table.getViewExpandedText().orElse(null));
  14. return result;
  15. }

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

  1. private CopyableDatasetRequestor getRequestor(String dbName, String tableName) {
  2. CopyableDatasetRequestor requestor = Mockito.mock(CopyableDatasetRequestor.class);
  3. HiveDataset dataset = Mockito.mock(HiveDataset.class);
  4. Table table = new Table(new org.apache.hadoop.hive.metastore.api.Table());
  5. table.setDbName(dbName);
  6. table.setTableName(tableName);
  7. Mockito.when(dataset.getTable()).thenReturn(table);
  8. Mockito.when(requestor.getDataset()).thenReturn(dataset);
  9. return requestor;
  10. }
  11. }

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

  1. private Table createTestTbl(String dbName, String tblName, String tblOwner,
  2. List<FieldSchema> cols, List<FieldSchema> ptnCols) {
  3. String serdeLocation = "file:/tmp";
  4. Map<String, String> serdeParams = new HashMap<>();
  5. Map<String, String> tblParams = new HashMap<>();
  6. SerDeInfo serdeInfo = new SerDeInfo("serde", "seriallib", new HashMap<>());
  7. StorageDescriptor sd = new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0,
  8. serdeInfo, null, null, serdeParams);
  9. sd.setStoredAsSubDirectories(false);
  10. Table tbl = new Table(tblName, dbName, tblOwner, 0, 0, 0, sd, ptnCols, tblParams, null, null,
  11. TableType.MANAGED_TABLE.toString());
  12. tbl.setCatName(DEFAULT_CATALOG_NAME);
  13. return tbl;
  14. }

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

  1. private HiveTargetPathHelper createTestTargetPathHelper(Properties properties) {
  2. HiveDataset dataset = Mockito.mock(HiveDataset.class);
  3. Table table = new Table(new org.apache.hadoop.hive.metastore.api.Table());
  4. table.setDbName("dbName");
  5. table.setTableName("tableName");
  6. Mockito.when(dataset.getTable()).thenReturn(table);
  7. Mockito.when(dataset.getTableRootPath()).thenReturn(Optional.of(TABLE_ROOT));
  8. Mockito.when(dataset.getProperties()).thenReturn(properties);
  9. HiveTargetPathHelper helper = new HiveTargetPathHelper(dataset);
  10. return helper;
  11. }

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

  1. public static Table getTestTable(String dbName, String tableName) {
  2. Table table = new Table();
  3. table.setDbName(dbName);
  4. table.setTableName(tableName);
  5. table.setTableType(TableType.EXTERNAL_TABLE.name());
  6. StorageDescriptor sd = new StorageDescriptor();
  7. sd.setLocation("/tmp/test");
  8. table.setSd(sd);
  9. return table;
  10. }

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

  1. @Test
  2. public void testCreateTable() throws IOException {
  3. Table t = new Table();
  4. t.setDbName("testdb");
  5. t.setTableName("testtable");
  6. NotificationEvent event = new NotificationEvent(getEventId(), getTime(),
  7. HCatConstants.HCAT_CREATE_TABLE_EVENT, msgFactory.buildCreateTableMessage(t).toString());
  8. event.setDbName(t.getDbName());
  9. event.setTableName(t.getTableName());
  10. HCatNotificationEvent hev = new HCatNotificationEvent(event);
  11. ReplicationTask rtask = ReplicationTask.create(client,hev);
  12. assertEquals(hev.toString(), rtask.getEvent().toString());
  13. verifyCreateTableReplicationTask(rtask);
  14. }

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

  1. @Test
  2. public void testDropTable() throws IOException {
  3. Table t = new Table();
  4. t.setDbName("testdb");
  5. t.setTableName("testtable");
  6. NotificationEvent event = new NotificationEvent(getEventId(), getTime(),
  7. HCatConstants.HCAT_DROP_TABLE_EVENT, msgFactory.buildDropTableMessage(t).toString());
  8. event.setDbName(t.getDbName());
  9. event.setTableName(t.getTableName());
  10. HCatNotificationEvent hev = new HCatNotificationEvent(event);
  11. ReplicationTask rtask = ReplicationTask.create(client,hev);
  12. assertEquals(hev.toString(), rtask.getEvent().toString());
  13. verifyDropTableReplicationTask(rtask);
  14. }

相关文章

Table类方法