本文整理了Java中org.apache.lens.api.metastore.XPartition.getUpdatePeriod()
方法的一些代码示例,展示了XPartition.getUpdatePeriod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPartition.getUpdatePeriod()
方法的具体详情如下:
包路径:org.apache.lens.api.metastore.XPartition
类名称:XPartition
方法名:getUpdatePeriod
[英]Gets the value of the updatePeriod property.
[中]获取updatePeriod属性的值。
代码示例来源:origin: apache/lens
/**
* Add a new partition for a storage of dimension
*
* @param sessionid The sessionid in which user is working
* @param dimTableName dimension table name
* @param storage storage name
* @param partition {@link XPartition} representation of partition
* @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful. {@link APIResult} with state
* {@link Status#FAILED}, if add has failed
*/
@POST
@Path("/dimtables/{dimTableName}/storages/{storage}/partition")
public APIResult addPartitionToDimStorage(@QueryParam("sessionid") LensSessionHandle sessionid,
@PathParam("dimTableName") String dimTableName,
@PathParam("storage") String storage,
XPartition partition) throws LensException {
checkSessionId(sessionid);
checkNonNullArgs("Partition is null", partition);
checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(),
partition.getUpdatePeriod());
return successOrPartialOrFailure(getSvc().addPartitionToDimStorage(sessionid, dimTableName, storage, partition), 1);
}
代码示例来源:origin: apache/lens
/**
* Add a new partition for a storage of fact
*
* @param sessionid The sessionid in which user is working
* @param factName fact table name
* @param storage storage name
* @param partition {@link XPartition} representation of partition
* @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful. {@link APIResult} with state
* {@link Status#FAILED}, if add has failed
*/
@POST
@Path("/facts/{factName}/storages/{storage}/partition")
public APIResult addPartitionToFactStorage(@QueryParam("sessionid") LensSessionHandle sessionid,
@PathParam("factName") String factName,
@PathParam("storage") String storage,
XPartition partition) throws LensException {
checkSessionId(sessionid);
checkNonNullArgs("Partition is null", partition);
checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(),
partition.getUpdatePeriod());
return successOrPartialOrFailure(getSvc().addPartitionToFactStorage(sessionid, factName, storage, partition), 1);
}
代码示例来源:origin: apache/lens
@Override
public void updatePartitions(LensSessionHandle sessionid, String tblName, String storageName,
XPartitionList xPartitions) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)) {
CubeMetastoreClient client = getClient(sessionid);
Set<String> storageTableNames = getAllTablesForStorage(sessionid, tblName, storageName);
Map<UpdatePeriod, List<Partition>> partitionsToUpdate = new HashMap<>();
for (String storageTableName : storageTableNames) {
for (XPartition xPartition : xPartitions.getPartition()) {
Partition existingPartition = client.getPartitionByFilter(storageTableName,
StorageConstants.getPartFilter(JAXBUtils.getFullPartSpecAsMap(xPartition)));
JAXBUtils.updatePartitionFromXPartition(existingPartition, xPartition);
UpdatePeriod updatePeriod = UpdatePeriod.valueOf(xPartition.getUpdatePeriod().value());
List<Partition> partitionList = partitionsToUpdate.get(updatePeriod);
if (partitionList == null) {
partitionList = new ArrayList<>();
partitionsToUpdate.put(updatePeriod, partitionList);
}
partitionList.add(existingPartition);
}
}
client.updatePartitions(tblName, storageName, partitionsToUpdate);
} catch (HiveException | ClassNotFoundException | InvalidOperationException exc) {
throw new LensException(exc);
}
}
代码示例来源:origin: org.apache.lens/lens-cube
public static Map<String, String> getFullPartSpecAsMap(XPartition partition) {
Map<String, String> spec = Maps.newHashMap();
if (partition.getTimePartitionSpec() != null) {
for (XTimePartSpecElement timePartSpecElement : partition.getTimePartitionSpec().getPartSpecElement()) {
spec.put(timePartSpecElement.getKey(), UpdatePeriod.valueOf(partition.getUpdatePeriod().name()).format()
.format(getDateFromXML(timePartSpecElement.getValue())));
}
}
if (partition.getNonTimePartitionSpec() != null) {
for (XPartSpecElement partSpecElement : partition.getNonTimePartitionSpec().getPartSpecElement()) {
spec.put(partSpecElement.getKey(), partSpecElement.getValue());
}
}
return spec;
}
}
代码示例来源:origin: apache/lens
public static Map<String, String> getFullPartSpecAsMap(XPartition partition) {
Map<String, String> spec = Maps.newHashMap();
if (partition.getTimePartitionSpec() != null) {
for (XTimePartSpecElement timePartSpecElement : partition.getTimePartitionSpec().getPartSpecElement()) {
spec.put(timePartSpecElement.getKey(), UpdatePeriod.valueOf(partition.getUpdatePeriod().name()).format()
.format(getDateFromXML(timePartSpecElement.getValue())));
}
}
if (partition.getNonTimePartitionSpec() != null) {
for (XPartSpecElement partSpecElement : partition.getNonTimePartitionSpec().getPartSpecElement()) {
spec.put(partSpecElement.getKey(), partSpecElement.getValue());
}
}
return spec;
}
}
代码示例来源:origin: apache/lens
private APIResult checkAndUpdatePartitions(LensSessionHandle sessionid, String table, String storage,
XPartition partition) throws LensException {
checkSessionId(sessionid);
checkNonNullArgs("Partition is null", partition);
checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(),
partition.getUpdatePeriod());
getSvc().updatePartition(sessionid, table, storage, partition);
return success();
}
}
代码示例来源:origin: org.apache.lens/lens-cube
public static void updatePartitionFromXPartition(Partition partition, XPartition xp) throws ClassNotFoundException {
partition.getParameters().putAll(mapFromXProperties(xp.getPartitionParameters()));
partition.getTPartition().getSd().getSerdeInfo().setParameters(mapFromXProperties(xp.getSerdeParameters()));
partition.setLocation(xp.getLocation());
if (xp.getInputFormat() != null) {
partition.setInputFormatClass(Class.forName(xp.getInputFormat()).asSubclass(InputFormat.class));
}
if (xp.getOutputFormat() != null) {
Class<? extends HiveOutputFormat> outputFormatClass =
Class.forName(xp.getOutputFormat()).asSubclass(HiveOutputFormat.class);
partition.setOutputFormatClass(outputFormatClass);
}
partition.getParameters().put(MetastoreConstants.PARTITION_UPDATE_PERIOD, xp.getUpdatePeriod().name());
partition.getTPartition().getSd().getSerdeInfo().setSerializationLib(xp.getSerdeClassname());
}
代码示例来源:origin: apache/lens
public static void updatePartitionFromXPartition(Partition partition, XPartition xp) throws ClassNotFoundException {
partition.getParameters().putAll(mapFromXProperties(xp.getPartitionParameters()));
partition.getTPartition().getSd().getSerdeInfo().setParameters(mapFromXProperties(xp.getSerdeParameters()));
partition.setLocation(xp.getLocation());
if (xp.getInputFormat() != null) {
partition.setInputFormatClass(Class.forName(xp.getInputFormat()).asSubclass(InputFormat.class));
}
if (xp.getOutputFormat() != null) {
Class<? extends HiveOutputFormat> outputFormatClass =
Class.forName(xp.getOutputFormat()).asSubclass(HiveOutputFormat.class);
partition.setOutputFormatClass(outputFormatClass);
}
partition.getParameters().put(MetastoreConstants.PARTITION_UPDATE_PERIOD, xp.getUpdatePeriod().name());
partition.getTPartition().getSd().getSerdeInfo().setSerializationLib(xp.getSerdeClassname());
}
代码示例来源:origin: apache/lens
@Override
public void updatePartition(LensSessionHandle sessionid, String tblName, String storageName, XPartition xPartition)
throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)) {
CubeMetastoreClient client = getClient(sessionid);
String storageTableName = client
.getStorageTableName(tblName, storageName, UpdatePeriod.valueOf(xPartition.getUpdatePeriod().name()));
Partition existingPartition = client.getPartitionByFilter(storageTableName,
StorageConstants.getPartFilter(JAXBUtils.getFullPartSpecAsMap(xPartition)));
JAXBUtils.updatePartitionFromXPartition(existingPartition, xPartition);
client.updatePartition(tblName, storageName, existingPartition,
UpdatePeriod.valueOf(xPartition.getUpdatePeriod().value()));
} catch (HiveException | ClassNotFoundException | InvalidOperationException | UnsupportedOperationException exc) {
throw new LensException(exc);
}
}
代码示例来源:origin: org.apache.lens/lens-cube
timePartSpecElement.setKey(entry.getKey());
timePartSpecElement
.setValue(getXMLGregorianCalendar(UpdatePeriod.valueOf(xp.getUpdatePeriod().name()).parse(
entry.getValue())));
xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpecElement);
代码示例来源:origin: apache/lens
timePartSpecElement.setKey(entry.getKey());
timePartSpecElement
.setValue(getXMLGregorianCalendar(UpdatePeriod.valueOf(xp.getUpdatePeriod().name()).parse(
entry.getValue())));
xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpecElement);
代码示例来源:origin: apache/lens
assertEquals(timePartSpec.getKey(), fullPartSpec.getKey());
assertEquals(
UpdatePeriod.valueOf(xp.getUpdatePeriod().name()).format(JAXBUtils.getDateFromXML(timePartSpec.getValue())),
fullPartSpec.getValue());
DateTime date = target().path("metastore/cubes").path("testCube").path("latestdate")
代码示例来源:origin: org.apache.lens/lens-cube
public static StoragePartitionDesc storagePartSpecFromXPartition(
XPartition xpart) {
StoragePartitionDesc partDesc = new StoragePartitionDesc(
xpart.getFactOrDimensionTableName(),
timePartSpecfromXTimePartSpec(xpart.getTimePartitionSpec()),
nonTimePartSpecfromXNonTimePartSpec(xpart.getNonTimePartitionSpec()),
UpdatePeriod.valueOf(xpart.getUpdatePeriod().name()));
partDesc.setPartParams(mapFromXProperties(xpart.getPartitionParameters()));
partDesc.setSerdeParams(mapFromXProperties(xpart.getSerdeParameters()));
partDesc.setLocation(xpart.getLocation());
partDesc.setInputFormat(xpart.getInputFormat());
partDesc.setOutputFormat(xpart.getOutputFormat());
partDesc.setSerializationLib(xpart.getSerdeClassname());
return partDesc;
}
代码示例来源:origin: apache/lens
public static StoragePartitionDesc storagePartSpecFromXPartition(
XPartition xpart) {
StoragePartitionDesc partDesc = new StoragePartitionDesc(
xpart.getFactOrDimensionTableName(),
timePartSpecfromXTimePartSpec(xpart.getTimePartitionSpec()),
nonTimePartSpecfromXNonTimePartSpec(xpart.getNonTimePartitionSpec()),
UpdatePeriod.valueOf(xpart.getUpdatePeriod().name()));
partDesc.setPartParams(mapFromXProperties(xpart.getPartitionParameters()));
partDesc.setSerdeParams(mapFromXProperties(xpart.getSerdeParameters()));
partDesc.setLocation(xpart.getLocation());
partDesc.setInputFormat(xpart.getInputFormat());
partDesc.setOutputFormat(xpart.getOutputFormat());
partDesc.setSerializationLib(xpart.getSerdeClassname());
return partDesc;
}
代码示例来源:origin: org.apache.lens/lens-api
theUpdatePeriod = this.getUpdatePeriod();
strategy.appendField(locator, this, "updatePeriod", buffer, theUpdatePeriod);
代码示例来源:origin: apache/lens
theUpdatePeriod = this.getUpdatePeriod();
strategy.appendField(locator, this, "updatePeriod", buffer, theUpdatePeriod);
代码示例来源:origin: org.apache.lens/lens-api
lhsUpdatePeriod = this.getUpdatePeriod();
XUpdatePeriod rhsUpdatePeriod;
rhsUpdatePeriod = that.getUpdatePeriod();
if (!strategy.equals(LocatorUtils.property(thisLocator, "updatePeriod", lhsUpdatePeriod), LocatorUtils.property(thatLocator, "updatePeriod", rhsUpdatePeriod), lhsUpdatePeriod, rhsUpdatePeriod)) {
return false;
代码示例来源:origin: apache/lens
lhsUpdatePeriod = this.getUpdatePeriod();
XUpdatePeriod rhsUpdatePeriod;
rhsUpdatePeriod = that.getUpdatePeriod();
if (!strategy.equals(LocatorUtils.property(thisLocator, "updatePeriod", lhsUpdatePeriod), LocatorUtils.property(thatLocator, "updatePeriod", rhsUpdatePeriod), lhsUpdatePeriod, rhsUpdatePeriod)) {
return false;
代码示例来源:origin: apache/lens
theUpdatePeriod = this.getUpdatePeriod();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "updatePeriod", theUpdatePeriod), currentHashCode, theUpdatePeriod);
代码示例来源:origin: org.apache.lens/lens-api
theUpdatePeriod = this.getUpdatePeriod();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "updatePeriod", theUpdatePeriod), currentHashCode, theUpdatePeriod);
内容来源于网络,如有侵权,请联系作者删除!