本文整理了Java中org.apache.hadoop.hive.metastore.api.Partition.setCreateTime()
方法的一些代码示例,展示了Partition.setCreateTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition.setCreateTime()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Partition
类名称:Partition
方法名:setCreateTime
暂无
代码示例来源:origin: apache/hive
@Override public void setCreateTime(long time) { partition.setCreateTime((int)time);}
@Override public boolean hasNext() { return false; } // No next partition.
代码示例来源:origin: apache/hive
@Override
public void setCreateTime(long time) {
partitionList.get(index).setCreateTime((int)time);
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Sets create time if not already set.
*/
private Partition getPartitionWithCreateTime(Partition partition, int createTime) {
if (partition.isSetCreateTime() && partition.getCreateTime() > 0) {
return partition;
}
Partition actualPartition = partition.deepCopy();
actualPartition.setCreateTime(createTime);
return actualPartition;
}
代码示例来源:origin: apache/incubator-gobblin
public org.apache.hadoop.hive.ql.metadata.Partition createDummyPartition(long createTime) {
org.apache.hadoop.hive.ql.metadata.Partition partition = new org.apache.hadoop.hive.ql.metadata.Partition();
Partition tPartition = new Partition();
tPartition.setCreateTime((int) TimeUnit.SECONDS.convert(createTime, TimeUnit.MILLISECONDS));
partition.setTPartition(tPartition);
return partition;
}
}
代码示例来源:origin: apache/incubator-gobblin
/**
* Convert a {@link HivePartition} into a {@link Partition}.
*/
public static Partition getPartition(HivePartition hivePartition) {
State props = hivePartition.getProps();
Partition partition = new Partition();
partition.setDbName(hivePartition.getDbName());
partition.setTableName(hivePartition.getTableName());
partition.setValues(hivePartition.getValues());
partition.setParameters(getParameters(props));
if (hivePartition.getCreateTime().isPresent()) {
partition.setCreateTime(Ints.checkedCast(hivePartition.getCreateTime().get()));
} else if (props.contains(HiveConstants.CREATE_TIME)) {
partition.setCreateTime(props.getPropAsInt(HiveConstants.CREATE_TIME));
}
if (props.contains(HiveConstants.LAST_ACCESS_TIME)) {
partition.setLastAccessTime(props.getPropAsInt(HiveConstants.LAST_ACCESS_TIME));
}
partition.setSd(getStorageDescriptor(hivePartition));
return partition;
}
代码示例来源:origin: apache/hive
Partition toHivePartition() throws HCatException {
Partition hivePtn = new Partition();
hivePtn.setDbName(dbName);
hivePtn.setTableName(tableName);
hivePtn.setValues(values);
hivePtn.setParameters(parameters);
if (sd.getLocation() == null) {
LOG.warn("Partition location is not set! Attempting to construct default partition location.");
try {
String partName = Warehouse.makePartName(HCatSchemaUtils.getFieldSchemas(hcatTable.getPartCols()), values);
sd.setLocation(new Path(hcatTable.getSd().getLocation(), partName).toString());
}
catch(MetaException exception) {
throw new HCatException("Could not construct default partition-path for "
+ hcatTable.getDbName() + "." + hcatTable.getTableName() + "[" + values + "]");
}
}
hivePtn.setSd(sd);
hivePtn.setCreateTime((int) (System.currentTimeMillis() / 1000));
hivePtn.setLastAccessTimeIsSet(false);
return hivePtn;
}
代码示例来源:origin: apache/hive
part.setDbName(dbName);
part.setTableName(tblName);
if (fields[4] != null) part.setCreateTime(MetastoreDirectSqlUtils.extractSqlInt(fields[4]));
if (fields[5] != null) part.setLastAccessTime(MetastoreDirectSqlUtils.extractSqlInt(fields[5]));
Long writeId = MetastoreDirectSqlUtils.extractSqlLong(fields[14]);
代码示例来源:origin: apache/hive
private static void makeTestChangesOnPartition(Partition partition) {
partition.getParameters().put("hmsTestParam001", "testValue001");
partition.setCreateTime(NEW_CREATE_TIME);
partition.setLastAccessTime(NEW_CREATE_TIME);
partition.getSd().setLocation(partition.getSd().getLocation()+"/hh=01");
partition.getSd().getCols().add(new FieldSchema("newcol", "string", ""));
}
代码示例来源:origin: apache/hive
private static void adjust(HiveMetaStoreClient client, Partition part,
String dbName, String tblName, boolean isThriftClient) throws TException {
Partition part_get = client.getPartition(dbName, tblName, part.getValues());
if (isThriftClient) {
part.setCreateTime(part_get.getCreateTime());
part.putToParameters(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.DDL_TIME, Long.toString(part_get.getCreateTime()));
}
part.setWriteId(part_get.getWriteId());
}
代码示例来源:origin: apache/incubator-gobblin
public Partition addTestPartition(Table tbl, List<String> values, int createTime) throws Exception {
StorageDescriptor partitionSd = new StorageDescriptor();
if (StringUtils.isNotBlank(tbl.getSd().getLocation())) {
partitionSd.setLocation(tbl.getSd().getLocation() + values);
} else {
partitionSd.setLocation("/tmp/" + tbl.getTableName() + "/part1");
}
partitionSd.setSerdeInfo(
new SerDeInfo("name", "serializationLib", ImmutableMap.of(HiveAvroSerDeManager.SCHEMA_URL, "/tmp/dummy")));
partitionSd.setCols(tbl.getPartitionKeys());
Partition partition =
new Partition(values, tbl.getDbName(), tbl.getTableName(), 1, 1, partitionSd, new HashMap<String, String>());
partition.setCreateTime(createTime);
return this.getLocalMetastoreClient().add_partition(partition);
}
代码示例来源:origin: apache/hive
part.setCreateTime((int) time);
part.putToParameters(hive_metastoreConstants.DDL_TIME, Long.toString(time));
代码示例来源:origin: apache/hive
unsetCreateTime();
} else {
setCreateTime((Integer)value);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override public void setCreateTime(long time) { partition.setCreateTime((int)time);}
@Override public boolean hasNext() { return false; } // No next partition.
代码示例来源:origin: org.spark-project.hive/hive-metastore
@Override
public void setCreateTime(long time) {
partitionList.get(index).setCreateTime((int)time);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
public void setCreateTime(long time) {
partitionList.get(index).setCreateTime((int)time);
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
@Override
public void setCreateTime(long time) {
partitionList.get(index).setCreateTime((int)time);
}
代码示例来源:origin: airbnb/reair
/**
* Remove (or set to 0) fields in the partition object that should not be compared.
*
* @param partition the partition to remove non-comparable fields
* @return the partition with non-comparable fields removed
*/
public static Partition stripNonComparables(Partition partition) {
Partition newPartition = new Partition(partition);
newPartition.setCreateTime(0);
newPartition.setLastAccessTime(0);
return newPartition;
}
代码示例来源:origin: airbnb/reair
/**
* Remove (or set to 0) fields in the partition object that should not be compared.
*
* @param partition the partition to remove non-comparable fields
* @return the partition with non-comparable fields removed
*/
public static Partition stripNonComparables(Partition partition) {
Partition newPartition = new Partition(partition);
newPartition.setCreateTime(0);
newPartition.setLastAccessTime(0);
return newPartition;
}
代码示例来源:origin: org.apache.gobblin/gobblin-hive-registration
/**
* Sets create time if not already set.
*/
private Partition getPartitionWithCreateTime(Partition partition, int createTime) {
if (partition.isSetCreateTime() && partition.getCreateTime() > 0) {
return partition;
}
Partition actualPartition = partition.deepCopy();
actualPartition.setCreateTime(createTime);
return actualPartition;
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-hive-registration
/**
* Sets create time if not already set.
*/
private Partition getPartitionWithCreateTime(Partition partition, int createTime) {
if (partition.isSetCreateTime() && partition.getCreateTime() > 0) {
return partition;
}
Partition actualPartition = partition.deepCopy();
actualPartition.setCreateTime(createTime);
return actualPartition;
}
内容来源于网络,如有侵权,请联系作者删除!