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

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

本文整理了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

public int getCreateTime() {
 return tTable.getCreateTime();
}

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

public int getCreateTime() {
 return tTable.getCreateTime();
}

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

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

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

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

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

/**
 * Sets create time if not already set.
 */
private Table gettableWithCreateTime(Table table, int createTime) {
 if (table.isSetCreateTime() && table.getCreateTime() > 0) {
  return table;
 }
 Table actualtable = table.deepCopy();
 actualtable.setCreateTime(createTime);
 return actualtable;
}

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

private static State getTableProps(Table table) {
 State tableProps = new State();
 for (Map.Entry<String, String> entry : table.getParameters().entrySet()) {
  tableProps.setProp(entry.getKey(), entry.getValue());
 }
 if (table.isSetCreateTime()) {
  tableProps.setProp(HiveConstants.CREATE_TIME, table.getCreateTime());
 }
 if (table.isSetLastAccessTime()) {
  tableProps.setProp(HiveConstants.LAST_ACCESS_TIME, table.getCreateTime());
 }
 if (table.isSetOwner()) {
  tableProps.setProp(HiveConstants.OWNER, table.getOwner());
 }
 if (table.isSetTableType()) {
  tableProps.setProp(HiveConstants.TABLE_TYPE, table.getTableType());
 }
 if (table.isSetRetention()) {
  tableProps.setProp(HiveConstants.RETENTION, table.getRetention());
 }
 return tableProps;
}

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

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

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

private static void getTableMetaDataInformation(StringBuilder tableInfo, Table  tbl,
  boolean isOutputPadded) {
 formatOutput("Database:", tbl.getDbName(), tableInfo);
 formatOutput("Owner:", tbl.getOwner(), tableInfo);
 formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
 formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
 formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
 if (!tbl.isView()) {
  formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
 }
 formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
 if (tbl.getParameters().size() > 0) {
  tableInfo.append("Table Parameters:").append(LINE_DELIM);
  displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
 }
}

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

private static void getTableMetaDataInformation(StringBuilder tableInfo, Table  tbl,
  boolean isOutputPadded) {
 formatOutput("Database:", tbl.getDbName(), tableInfo);
 formatOutput("OwnerType:", (tbl.getOwnerType() != null) ? tbl.getOwnerType().name() : "null", tableInfo);
 formatOutput("Owner:", tbl.getOwner(), tableInfo);
 formatOutput("CreateTime:", formatDate(tbl.getTTable().getCreateTime()), tableInfo);
 formatOutput("LastAccessTime:", formatDate(tbl.getTTable().getLastAccessTime()), tableInfo);
 formatOutput("Retention:", Integer.toString(tbl.getRetention()), tableInfo);
 if (!tbl.isView()) {
  formatOutput("Location:", tbl.getDataLocation().toString(), tableInfo);
 }
 formatOutput("Table Type:", tbl.getTableType().name(), tableInfo);
 if (tbl.getParameters().size() > 0) {
  tableInfo.append("Table Parameters:").append(LINE_DELIM);
  displayAllParameters(tbl.getParameters(), tableInfo, false, isOutputPadded);
 }
}

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

@Test
public void testGetWorkunitsAfterWatermark() throws Exception {
 String dbName = "testdb4";
 String tableName1 = "testtable1";
 String tableSdLoc1 = "/tmp/testtable1";
 String tableName2 = "testtable2";
 String tableSdLoc2 = "/tmp/testtable2";
 this.hiveMetastoreTestUtils.getLocalMetastoreClient().dropDatabase(dbName, false, true, true);
 this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName1, tableSdLoc1, Optional.<String> absent());
 this.hiveMetastoreTestUtils.createTestAvroTable(dbName, tableName2, tableSdLoc2, Optional.<String> absent(), true);
 List<WorkUnitState> previousWorkUnitStates = Lists.newArrayList();
 Table table1 = this.hiveMetastoreTestUtils.getLocalMetastoreClient().getTable(dbName, tableName1);
 previousWorkUnitStates.add(ConversionHiveTestUtils.createWus(dbName, tableName1,
   TimeUnit.MILLISECONDS.convert(table1.getCreateTime(), TimeUnit.SECONDS)));
 SourceState testState = new SourceState(getTestState(dbName), previousWorkUnitStates);
 testState.setProp(HiveSource.HIVE_SOURCE_WATERMARKER_FACTORY_CLASS_KEY, TableLevelWatermarker.Factory.class.getName());
 List<WorkUnit> workUnits = this.hiveSource.getWorkunits(testState);
 Assert.assertEquals(workUnits.size(), 1);
 WorkUnit wu = workUnits.get(0);
 HiveWorkUnit hwu = new HiveWorkUnit(wu);
 Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getDb(), dbName);
 Assert.assertEquals(hwu.getHiveDataset().getDbAndTable().getTable(), tableName2);
}

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

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

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

/**
 * Convert a {@link Table} into a {@link HiveTable}.
 */
public static HiveTable getHiveTable(Table table) {
 State tableProps = getTableProps(table);
 State storageProps = getStorageProps(table.getSd());
 State serDeProps = getSerDeProps(table.getSd().getSerdeInfo());
 HiveTable hiveTable = new HiveTable.Builder().withDbName(table.getDbName()).withTableName(table.getTableName())
   .withPartitionKeys(getColumns(table.getPartitionKeys())).withProps(tableProps).withStorageProps(storageProps)
   .withSerdeProps(serDeProps).build();
 if (table.getCreateTime() > 0) {
  hiveTable.setCreateTime(table.getCreateTime());
 }
 if (table.getSd().getCols() != null) {
  hiveTable.setColumns(getColumns(table.getSd().getCols()));
 }
 if (table.getSd().getBucketCols() != null) {
  hiveTable.setBucketColumns(table.getSd().getBucketCols());
 }
 return hiveTable;
}

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

return getCreateTime();

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

@Test
public void testAlterTable() throws Exception {
 Table originalTable = testTables[2];
 String originalTableName = originalTable.getTableName();
 String originalDatabase = originalTable.getDbName();
 Table newTable = getTableWithAllParametersSet();
 newTable.setTableName(originalTableName);
 newTable.setDbName(originalDatabase);
 // Partition keys can not be set, but getTableWithAllParametersSet is added one, so remove for
 // this test
 newTable.setPartitionKeys(originalTable.getPartitionKeys());
 client.alter_table(originalDatabase, originalTableName, newTable);
 Table alteredTable = client.getTable(originalDatabase, originalTableName);
 // The extra parameters will be added on server side, so check that the required ones are
 // present
 for(String key: newTable.getParameters().keySet()) {
  Assert.assertEquals("parameters are present", newTable.getParameters().get(key),
    alteredTable.getParameters().get(key));
 }
 // The parameters are checked manually, so do not check them
 newTable.setParameters(alteredTable.getParameters());
 // Some of the data is set on the server side, so reset those
 newTable.setCreateTime(alteredTable.getCreateTime());
 newTable.setCreationMetadata(alteredTable.getCreationMetadata());
 newTable.setWriteId(alteredTable.getWriteId());
 Assert.assertTrue(alteredTable.isSetId());
 alteredTable.unsetId();
 Assert.assertEquals("The table data should be the same", newTable, alteredTable);
}

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

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

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

table.setCreateTime(createdTable.getCreateTime());

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

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

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

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

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

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

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

/**
 * Sets create time if not already set.
 */
private Table gettableWithCreateTime(Table table, int createTime) {
 if (table.isSetCreateTime() && table.getCreateTime() > 0) {
  return table;
 }
 Table actualtable = table.deepCopy();
 actualtable.setCreateTime(createTime);
 return actualtable;
}

相关文章

微信公众号

最新文章

更多

Table类方法