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

x33g5p2x  于2022-01-26 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(157)

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

Partition.getLastAccessTime介绍

暂无

代码示例

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

public int getLastAccessTime() {
 return tPartition.getLastAccessTime();
}

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

public int getLastAccessTime() {
 return tPartition.getLastAccessTime();
}

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

private void assertPartitionUnchanged(Partition partition, List<String> testValues,
                       List<String> partCols) throws MetaException {
 assertFalse(partition.getParameters().containsKey("hmsTestParam001"));
 List<String> expectedKVPairs = new ArrayList<>();
 for (int i = 0; i < partCols.size(); ++i) {
  expectedKVPairs.add(partCols.get(i) + "=" + testValues.get(i));
 }
 String partPath = expectedKVPairs.stream().collect(joining("/"));
 assertTrue(partition.getSd().getLocation().equals(metaStore.getWarehouseRoot()
   + "/testpartdb.db/testparttable/" + partPath));
 assertNotEquals(NEW_CREATE_TIME, partition.getCreateTime());
 assertNotEquals(NEW_CREATE_TIME, partition.getLastAccessTime());
 assertEquals(2, partition.getSd().getCols().size());
}

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

private void assertPartitionChanged(Partition partition, List<String> testValues,
                  List<String> partCols) throws MetaException {
 assertEquals("testValue001", partition.getParameters().get("hmsTestParam001"));
 List<String> expectedKVPairs = new ArrayList<>();
 for (int i = 0; i < partCols.size(); ++i) {
  expectedKVPairs.add(partCols.get(i) + "=" + testValues.get(i));
 }
 String partPath = expectedKVPairs.stream().collect(joining("/"));
 assertTrue(partition.getSd().getLocation().equals(metaStore.getWarehouseRoot()
   + "/testpartdb.db/testparttable/" + partPath + "/hh=01"));
 assertEquals(NEW_CREATE_TIME, partition.getCreateTime());
 assertEquals(NEW_CREATE_TIME, partition.getLastAccessTime());
 assertEquals(3, partition.getSd().getCols().size());
}

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

private static void getPartitionMetaDataInformation(StringBuilder tableInfo, Partition part) {
 formatOutput("Partition Value:", part.getValues().toString(), tableInfo);
 formatOutput("Database:", part.getTPartition().getDbName(), tableInfo);
 formatOutput("Table:", part.getTable().getTableName(), tableInfo);
 formatOutput("CreateTime:", formatDate(part.getTPartition().getCreateTime()), tableInfo);
 formatOutput("LastAccessTime:", formatDate(part.getTPartition().getLastAccessTime()),
   tableInfo);
 formatOutput("Location:", part.getLocation(), tableInfo);
 if (part.getTPartition().getParameters().size() > 0) {
  tableInfo.append("Partition Parameters:").append(LINE_DELIM);
  displayAllParameters(part.getTPartition().getParameters(), tableInfo);
 }
}

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

private static void getPartitionMetaDataInformation(StringBuilder tableInfo, Partition part) {
 formatOutput("Partition Value:", part.getValues().toString(), tableInfo);
 formatOutput("Database:", part.getTPartition().getDbName(), tableInfo);
 formatOutput("Table:", part.getTable().getTableName(), tableInfo);
 formatOutput("CreateTime:", formatDate(part.getTPartition().getCreateTime()), tableInfo);
 formatOutput("LastAccessTime:", formatDate(part.getTPartition().getLastAccessTime()),
   tableInfo);
 formatOutput("Location:", part.getLocation(), tableInfo);
 if (part.getTPartition().getParameters().size() > 0) {
  tableInfo.append("Partition Parameters:").append(LINE_DELIM);
  displayAllParameters(part.getTPartition().getParameters(), tableInfo);
 }
}

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

HCatPartition(HCatTable hcatTable, Partition partition) throws HCatException {
 this.hcatTable = hcatTable;
 this.tableName = partition.getTableName();
 this.dbName = partition.getDbName();
 this.createTime = partition.getCreateTime();
 this.lastAccessTime = partition.getLastAccessTime();
 this.parameters = partition.getParameters();
 this.values = partition.getValues();
 if (hcatTable != null && partition.getValuesSize() != hcatTable.getPartCols().size()) {
  throw new HCatException("Mismatched number of partition columns between table:" + hcatTable.getDbName() + "." + hcatTable.getTableName()
              + " and partition " + partition.getValues());
 }
 this.sd = partition.getSd();
 this.columns = getColumns(this.sd);
}

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

/**
 * Testing
 *    renamePartition(String,String,List(String),Partition) ->
 *    renamePartition(String,String,List(String),Partition).
 */
@Test
public void testRenamePartition() throws Exception {
 List<List<String>> oldValues = createTable4PartColsParts(client);
 List<List<String>> newValues = new ArrayList<>();
 List<String> newVal = Lists.newArrayList("2018", "01", "16");
 newValues.addAll(oldValues.subList(0, 3));
 newValues.add(newVal);
 List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
 Partition partToRename = oldParts.get(3);
 partToRename.setValues(newVal);
 makeTestChangesOnPartition(partToRename);
 client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), partToRename);
 List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
 assertPartitionsHaveCorrectValues(newParts, newValues);
 //Asserting other partition parameters can also be changed, but not the location
 assertFalse(newParts.get(3).getSd().getLocation().endsWith("hh=01"));
 assertEquals(3, newParts.get(3).getSd().getCols().size());
 assertEquals("testValue001", newParts.get(3).getParameters().get("hmsTestParam001"));
 assertEquals(NEW_CREATE_TIME, newParts.get(3).getCreateTime());
 assertEquals(NEW_CREATE_TIME, newParts.get(3).getLastAccessTime());
 assertTrue(client.listPartitions(DB_NAME, TABLE_NAME, oldValues.get(3), (short)-1).isEmpty());
}

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

public Object getFieldValue(_Fields field) {
 switch (field) {
 case VALUES:
  return getValues();
 case DB_NAME:
  return getDbName();
 case TABLE_NAME:
  return getTableName();
 case CREATE_TIME:
  return getCreateTime();
 case LAST_ACCESS_TIME:
  return getLastAccessTime();
 case SD:
  return getSd();
 case PARAMETERS:
  return getParameters();
 case PRIVILEGES:
  return getPrivileges();
 case CAT_NAME:
  return getCatName();
 case WRITE_ID:
  return getWriteId();
 case IS_STATS_COMPLIANT:
  return isIsStatsCompliant();
 case COL_STATS:
  return getColStats();
 }
 throw new IllegalStateException();
}

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

hiveDatasetVersion.getPartition().getTable().getTableName(),
sourcePartition.getCreateTime(),
sourcePartition.getLastAccessTime(),
sourcePartition.getSd(),
sourcePartition.getParameters());

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

private void verifyPartitionSharedSD(Table table, String name, List<String> values, int index)
  throws Exception {
 Partition part = client.getPartition(table.getDbName(), table.getTableName(), name);
 Assert.assertNotNull(part);
 Assert.assertEquals(table.getTableName(), part.getTableName());
 List<String> partValues = part.getValues();
 Assert.assertEquals(values.size(), partValues.size());
 Assert.assertTrue(partValues.containsAll(values));
 Assert.assertEquals(table.getDbName(), part.getDbName());
 Assert.assertEquals(DEFAULT_CREATE_TIME, part.getLastAccessTime());
 Assert.assertEquals(DEFAULT_PARAM_VALUE + index,
   part.getParameters().get(DEFAULT_PARAM_KEY + index));
 Assert.assertFalse(part.getParameters().keySet().contains(table.getParameters().keySet()));
 StorageDescriptor sd = part.getSd();
 Assert.assertNotNull(sd);
 Assert.assertEquals("TestInputFormat", sd.getInputFormat());
 Assert.assertEquals("TestOutputFormat", sd.getOutputFormat());
 Assert.assertEquals("sharedSDPartSerde", sd.getSerdeInfo().getName());
 Assert.assertEquals("testSDParamValue", sd.getParameters().get("testSDParamKey"));
 Assert.assertEquals(
   metaStore.getWarehouseRoot() + "/" + TABLE_NAME + "/sharedSDTest/partwithoutsd" + index,
   sd.getLocation());
 Assert.assertTrue(metaStore.isPathExists(new Path(sd.getLocation())));
}

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

fetched =
  client.getPartition(DEFAULT_DATABASE_NAME, tableName, Collections.singletonList("a1"));
Assert.assertEquals(3L, fetched.getLastAccessTime());
fetched =
  client.getPartition(DEFAULT_DATABASE_NAME, tableName, Collections.singletonList("a2"));

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

fetched =
  client.getPartition(dbName, tableName, Collections.singletonList("a1"));
Assert.assertEquals(3L, fetched.getLastAccessTime());
fetched =
  client.getPartition(dbName, tableName, Collections.singletonList("a2"));

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

PartitionWithoutSD retPartition = partitionWithoutSDS.get(i);
Assert.assertEquals(origPartition.getCreateTime(), retPartition.getCreateTime());
Assert.assertEquals(origPartition.getLastAccessTime(), retPartition.getLastAccessTime());
Assert.assertEquals(origPartition.getSd().getLocation(),
  sharedSD.getLocation() + retPartition.getRelativePath());

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

Assert.assertEquals("The DB name in the partition is not correct.", table.getDbName(),
  part.getDbName());
Assert.assertEquals("The last access time is not correct.", 123456, part.getLastAccessTime());
Assert.assertNotEquals(123456, part.getCreateTime());
Assert.assertEquals(

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

part.getDbName());
Assert.assertEquals("The last access time is not correct.", DEFAULT_CREATE_TIME,
  part.getLastAccessTime());
Assert.assertNotEquals(DEFAULT_CREATE_TIME, part.getCreateTime());
Assert.assertEquals(

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

private void verifyPartition(Partition partition, Table table, List<String> expectedPartValues,
  String partitionName) throws Exception {
 Assert.assertEquals(table.getTableName(), partition.getTableName());
 Assert.assertEquals(table.getDbName(), partition.getDbName());
 Assert.assertEquals(expectedPartValues, partition.getValues());
 Assert.assertNotEquals(0, partition.getCreateTime());
 Assert.assertEquals(0, partition.getLastAccessTime());
 Assert.assertEquals(1, partition.getParameters().size());
 Assert.assertTrue(partition.getParameters().containsKey("transient_lastDdlTime"));
 StorageDescriptor partitionSD = partition.getSd();
 Assert.assertEquals(table.getSd().getLocation() + "/" + partitionName,
   partitionSD.getLocation());
 partition.getSd().setLocation(table.getSd().getLocation());
 Assert.assertEquals(table.getSd(), partitionSD);
 Assert.assertTrue(metaStore.isPathExists(new Path(partitionSD.getLocation())));
}

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

private void verifyPartitionAttributesDefaultValues(Partition partition, String tableLocation) {
 Assert.assertNotEquals("The partition's last access time should be set.", 0,
   partition.getLastAccessTime());
 Assert.assertNotEquals("The partition's create time should be set.", 0,
   partition.getCreateTime());

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

.getCreateTime(), part.getLastAccessTime(),
  msd, part.getParameters());
return mpart;

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

client.getPartition(catName, dbName, tableName, Collections.singletonList("a1"));
Assert.assertEquals(catName, fetched.getCatName());
Assert.assertEquals(3L, fetched.getLastAccessTime());
fetched =
  client.getPartition(catName, dbName, tableName, Collections.singletonList("a2"));

相关文章

微信公众号

最新文章

更多

Partition类方法