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

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

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

Table.getCreateTime介绍

暂无

代码示例

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

  1. public int getCreateTime() {
  2. return tTable.getCreateTime();
  3. }

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

  1. public int getCreateTime() {
  2. return tTable.getCreateTime();
  3. }

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

  1. @Override
  2. public long getUpdateTime(Table table) throws UpdateNotFoundException {
  3. // TODO if a table/partition is registered by gobblin an update time will be made available in table properties
  4. // Use the update time instead of create time
  5. return TimeUnit.MILLISECONDS.convert(table.getTTable().getCreateTime(), TimeUnit.SECONDS);
  6. }

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

  1. protected static long getCreateTime(Table table) {
  2. return TimeUnit.MILLISECONDS.convert(table.getTTable().getCreateTime(), TimeUnit.SECONDS);
  3. }

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

  1. /**
  2. * Sets create time if not already set.
  3. */
  4. private Table gettableWithCreateTime(Table table, int createTime) {
  5. if (table.isSetCreateTime() && table.getCreateTime() > 0) {
  6. return table;
  7. }
  8. Table actualtable = table.deepCopy();
  9. actualtable.setCreateTime(createTime);
  10. return actualtable;
  11. }

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

  1. private static State getTableProps(Table table) {
  2. State tableProps = new State();
  3. for (Map.Entry<String, String> entry : table.getParameters().entrySet()) {
  4. tableProps.setProp(entry.getKey(), entry.getValue());
  5. }
  6. if (table.isSetCreateTime()) {
  7. tableProps.setProp(HiveConstants.CREATE_TIME, table.getCreateTime());
  8. }
  9. if (table.isSetLastAccessTime()) {
  10. tableProps.setProp(HiveConstants.LAST_ACCESS_TIME, table.getCreateTime());
  11. }
  12. if (table.isSetOwner()) {
  13. tableProps.setProp(HiveConstants.OWNER, table.getOwner());
  14. }
  15. if (table.isSetTableType()) {
  16. tableProps.setProp(HiveConstants.TABLE_TYPE, table.getTableType());
  17. }
  18. if (table.isSetRetention()) {
  19. tableProps.setProp(HiveConstants.RETENTION, table.getRetention());
  20. }
  21. return tableProps;
  22. }

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

  1. hiveDataset.getTable().getCompleteName(), updateTime, hiveDataset.getTable().getTTable().getCreateTime(),
  2. lowWatermark.getValue()));
  3. HiveWorkUnit hiveWorkUnit = workUnitForTable(hiveDataset);
  4. "Not creating workunit for table %s as updateTime %s and createTime %s is not greater than low watermark %s",
  5. hiveDataset.getTable().getCompleteName(), updateTime, hiveDataset.getTable().getTTable()
  6. .getCreateTime(), lowWatermark.getValue()));

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

  1. private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
  2. boolean isOutputPadded) {
  3. formatOutput("Database:", tbl.getDbName(), tableInfo);
  4. formatOutput("Owner:", tbl.getOwner(), tableInfo);
  5. formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
  6. formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
  7. formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
  8. if (!tbl.isView()) {
  9. formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
  10. }
  11. formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
  12. if (tbl.getParameters().size() > 0) {
  13. tableInfo.append("Table Parameters:").append(LINE_DELIM);
  14. displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
  15. }
  16. }

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

  1. private static void getTableMetaDataInformation(StringBuilder tableInfo, Table tbl,
  2. boolean isOutputPadded) {
  3. formatOutput("Database:", tbl.getDbName(), tableInfo);
  4. formatOutput("OwnerType:", (tbl.getOwnerType() != null) ? tbl.getOwnerType().name() : "null", tableInfo);
  5. formatOutput("Owner:", tbl.getOwner(), tableInfo);
  6. formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
  7. formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
  8. formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
  9. if (!tbl.isView()) {
  10. formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
  11. }
  12. formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
  13. if (tbl.getParameters().size() > 0) {
  14. tableInfo.append("Table Parameters:").append(LINE_DELIM);
  15. displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
  16. }
  17. }

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

  1. @Test
  2. public void testGetWorkunitsAfterWatermark() throws Exception {
  3. String dbName = "testdb4";
  4. String tableName1 = "testtable1";
  5. String tableSdLoc1 = "/tmp/testtable1";
  6. String tableName2 = "testtable2";
  7. String tableSdLoc2 = "/tmp/testtable2";
  8. this.hiveMetastoreTestUtils.getLocalMetastoreClient().dropDatabase(dbName, false, true, true);
  9. this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName1, tableSdLoc1, Optional.<String> absent());
  10. this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName2, tableSdLoc2, Optional.<String> absent(), true);
  11. List<WorkUnitState> previousWorkUnitStates = Lists.newArrayList();
  12. Table table1 = this.hiveMetastoreTestUtils.getLocalMetastoreClient().getTable(dbName, tableName1);
  13. previousWorkUnitStates.add(ConversionHiveTestUtils.createWus(dbName, tableName1,
  14. TimeUnit.MILLISECONDS.convert(table1.getCreateTime(), TimeUnit.SECONDS)));
  15. SourceState testState = new SourceState(getTestState(dbName), previousWorkUnitStates);
  16. testState.setProp(HiveSource.HIVE_SOURCE_WATERMARKER_FACTORY_CLASS_KEY, TableLevelWatermarker.Factory.class.getName());
  17. List<WorkUnit> workUnits = this.hiveSource.getWorkunits(testState);
  18. Assert.assertEquals(workUnits.size(), 1);
  19. WorkUnit wu = workUnits.get(0);
  20. HiveWorkUnit hwu = new HiveWorkUnit(wu);
  21. Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getDb(), dbName);
  22. Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getTable(), tableName2);
  23. }

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

  1. .getCreateTime(), tbl.getLastAccessTime(), tbl.getRetention(),
  2. convertToMFieldSchemas(tbl.getPartitionKeys()), tbl.getParameters(),
  3. tbl.getViewOriginalText(), tbl.getViewExpandedText(), tbl.isRewriteEnabled(),

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

  1. /**
  2. * Convert a {@link Table} into a {@link HiveTable}.
  3. */
  4. public static HiveTable getHiveTable(Table table) {
  5. State tableProps = getTableProps(table);
  6. State storageProps = getStorageProps(table.getSd());
  7. State serDeProps = getSerDeProps(table.getSd().getSerdeInfo());
  8. HiveTable hiveTable = new HiveTable.Builder().withDbName(table.getDbName()).withTableName(table.getTableName())
  9. .withPartitionKeys(getColumns(table.getPartitionKeys())).withProps(tableProps).withStorageProps(storageProps)
  10. .withSerdeProps(serDeProps).build();
  11. if (table.getCreateTime() > 0) {
  12. hiveTable.setCreateTime(table.getCreateTime());
  13. }
  14. if (table.getSd().getCols() != null) {
  15. hiveTable.setColumns(getColumns(table.getSd().getCols()));
  16. }
  17. if (table.getSd().getBucketCols() != null) {
  18. hiveTable.setBucketColumns(table.getSd().getBucketCols());
  19. }
  20. return hiveTable;
  21. }

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

  1. return getCreateTime();

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

  1. @Test
  2. public void testAlterTable() throws Exception {
  3. Table originalTable = testTables[2];
  4. String originalTableName = originalTable.getTableName();
  5. String originalDatabase = originalTable.getDbName();
  6. Table newTable = getTableWithAllParametersSet();
  7. newTable.setTableName(originalTableName);
  8. newTable.setDbName(originalDatabase);
  9. // Partition keys can not be set, but getTableWithAllParametersSet is added one, so remove for
  10. // this test
  11. newTable.setPartitionKeys(originalTable.getPartitionKeys());
  12. client.alter_table(originalDatabase, originalTableName, newTable);
  13. Table alteredTable = client.getTable(originalDatabase, originalTableName);
  14. // The extra parameters will be added on server side, so check that the required ones are
  15. // present
  16. for(String key: newTable.getParameters().keySet()) {
  17. Assert.assertEquals("parameters are present", newTable.getParameters().get(key),
  18. alteredTable.getParameters().get(key));
  19. }
  20. // The parameters are checked manually, so do not check them
  21. newTable.setParameters(alteredTable.getParameters());
  22. // Some of the data is set on the server side, so reset those
  23. newTable.setCreateTime(alteredTable.getCreateTime());
  24. newTable.setCreationMetadata(alteredTable.getCreationMetadata());
  25. newTable.setWriteId(alteredTable.getWriteId());
  26. Assert.assertTrue(alteredTable.isSetId());
  27. alteredTable.unsetId();
  28. Assert.assertEquals("The table data should be the same", newTable, alteredTable);
  29. }

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

  1. tbl.setCreateTime(ft.getTTable().getCreateTime());
  2. tbl.getParameters().put(hive_metastoreConstants.DDL_TIME,
  3. ft.getParameters().get(hive_metastoreConstants.DDL_TIME));

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

  1. table.setCreateTime(createdTable.getCreateTime());

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

  1. Assert.assertNotEquals("Comparing CreateTime", 0, createdTable.getCreateTime());
  2. Assert.assertEquals("Comparing LastAccessTime", 0, createdTable.getLastAccessTime());
  3. Assert.assertEquals("Comparing Retention", 0, createdTable.getRetention());

代码示例来源:origin: com.linkedin.gobblin/gobblin-data-management

  1. @Override
  2. public long getUpdateTime(Table table) throws UpdateNotFoundException {
  3. // TODO if a table/partition is registered by gobblin an update time will be made available in table properties
  4. // Use the update time instead of create time
  5. return TimeUnit.MILLISECONDS.convert(table.getTTable().getCreateTime(), TimeUnit.SECONDS);
  6. }

代码示例来源:origin: org.apache.gobblin/gobblin-data-management

  1. @Override
  2. public long getUpdateTime(Table table) throws UpdateNotFoundException {
  3. // TODO if a table/partition is registered by gobblin an update time will be made available in table properties
  4. // Use the update time instead of create time
  5. return TimeUnit.MILLISECONDS.convert(table.getTTable().getCreateTime(), TimeUnit.SECONDS);
  6. }

代码示例来源:origin: org.apache.gobblin/gobblin-hive-registration

  1. /**
  2. * Sets create time if not already set.
  3. */
  4. private Table gettableWithCreateTime(Table table, int createTime) {
  5. if (table.isSetCreateTime() && table.getCreateTime() > 0) {
  6. return table;
  7. }
  8. Table actualtable = table.deepCopy();
  9. actualtable.setCreateTime(createTime);
  10. return actualtable;
  11. }

相关文章

Table类方法