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; } }
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; } }
.setValue(getXMLGregorianCalendar(UpdatePeriod.valueOf(xp.getUpdatePeriod().name()).parse( entry.getValue()))); xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpecElement); } else { XPartSpecElement partSpecElement = new XPartSpecElement();
.setValue(getXMLGregorianCalendar(UpdatePeriod.valueOf(xp.getUpdatePeriod().name()).parse( entry.getValue()))); xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpecElement); } else { XPartSpecElement partSpecElement = new XPartSpecElement();
private XPartition createPartition(String cubeTableName, final List<XTimePartSpecElement> timePartSpecs, String updatePeriod) { XPartition xp = cubeObjectFactory.createXPartition(); xp.setLocation(new Path(new File("target").getAbsolutePath(), "part/test_part").toString()); xp.setFactOrDimensionTableName(cubeTableName); xp.setNonTimePartitionSpec(new XPartSpec()); xp.setTimePartitionSpec(new XTimePartSpec()); xp.setPartitionParameters(new XProperties()); xp.setSerdeParameters(new XProperties()); for (XTimePartSpecElement timePartSpec : timePartSpecs) { xp.getTimePartitionSpec().getPartSpecElement().add(timePartSpec); } if (updatePeriod==null) { xp.setUpdatePeriod(XUpdatePeriod.HOURLY); } else { XUpdatePeriod updatePeriod1=XUpdatePeriod.valueOf(updatePeriod.toUpperCase()); xp.setUpdatePeriod(updatePeriod1); } return xp; }
XPartition readPartition = partitions.getPartition().get(0); assertEquals(readPartition.getLocation(), xp.getLocation()); assertEquals(readPartition.getTimePartitionSpec(), xp.getTimePartitionSpec()); assertEquals(readPartition.getNonTimePartitionSpec(), xp.getNonTimePartitionSpec()); assertNotNull(readPartition.getFullPartitionSpec()); XTimePartSpecElement timePartSpec = readPartition.getTimePartitionSpec().getPartSpecElement().iterator().next(); XPartSpecElement fullPartSpec = readPartition.getFullPartitionSpec().getPartSpecElement().iterator().next(); assertEquals(timePartSpec.getKey(), fullPartSpec.getKey());
assertTrue(partitions.getPartition().get(0).getTimePartitionSpec() == null || partitions.getPartition().get(1).getTimePartitionSpec() == null); XPartition postedPartition, latestPartition; if (partitions.getPartition().get(0).getTimePartitionSpec() == null) { postedPartition = partitions.getPartition().get(1); latestPartition = partitions.getPartition().get(0); assertEquals(postedPartition.getTimePartitionSpec(), xp.getTimePartitionSpec()); assertEquals(postedPartition.getNonTimePartitionSpec(), xp.getNonTimePartitionSpec()); assertNotNull(postedPartition.getFullPartitionSpec()); XTimePartSpecElement timePartSpec = postedPartition.getTimePartitionSpec().getPartSpecElement().iterator().next(); XPartSpecElement fullPartSpec = postedPartition.getFullPartitionSpec().getPartSpecElement().iterator().next(); assertEquals(timePartSpec.getKey(), fullPartSpec.getKey()); timePartSpec.getValue())), fullPartSpec.getValue()); assertNull(latestPartition.getTimePartitionSpec()); assertNull(latestPartition.getNonTimePartitionSpec()); assertEquals(latestPartition.getFullPartitionSpec().getPartSpecElement().get(0).getValue(),
xp2.getTimePartitionSpec().getPartSpecElement() .add(createTimePartSpecElement(partDate, "non_existant_time_part")); Response response = target().path("metastore/facts/").path(table).path("storages/S2/partition") XPartition readPartition = partitions.getPartition().get(0); assertEquals(readPartition.getLocation(), xp.getLocation()); assertEquals(readPartition.getTimePartitionSpec(), xp.getTimePartitionSpec()); assertEquals(readPartition.getNonTimePartitionSpec(), xp.getNonTimePartitionSpec()); assertNotNull(readPartition.getFullPartitionSpec()); XTimePartSpecElement timePartSpec = readPartition.getTimePartitionSpec().getPartSpecElement().iterator().next(); XPartSpecElement fullPartSpec = readPartition.getFullPartitionSpec().getPartSpecElement().iterator().next(); assertEquals(timePartSpec.getKey(), fullPartSpec.getKey());
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; }
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; }
theTimePartitionSpec = this.getTimePartitionSpec(); strategy.appendField(locator, this, "timePartitionSpec", buffer, theTimePartitionSpec);
theTimePartitionSpec = this.getTimePartitionSpec(); strategy.appendField(locator, this, "timePartitionSpec", buffer, theTimePartitionSpec);
lhsTimePartitionSpec = this.getTimePartitionSpec(); XTimePartSpec rhsTimePartitionSpec; rhsTimePartitionSpec = that.getTimePartitionSpec(); if (!strategy.equals(LocatorUtils.property(thisLocator, "timePartitionSpec", lhsTimePartitionSpec), LocatorUtils.property(thatLocator, "timePartitionSpec", rhsTimePartitionSpec), lhsTimePartitionSpec, rhsTimePartitionSpec)) { return false;
lhsTimePartitionSpec = this.getTimePartitionSpec(); XTimePartSpec rhsTimePartitionSpec; rhsTimePartitionSpec = that.getTimePartitionSpec(); if (!strategy.equals(LocatorUtils.property(thisLocator, "timePartitionSpec", lhsTimePartitionSpec), LocatorUtils.property(thatLocator, "timePartitionSpec", rhsTimePartitionSpec), lhsTimePartitionSpec, rhsTimePartitionSpec)) { return false;
theTimePartitionSpec = this.getTimePartitionSpec(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "timePartitionSpec", theTimePartitionSpec), currentHashCode, theTimePartitionSpec);
theTimePartitionSpec = this.getTimePartitionSpec(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "timePartitionSpec", theTimePartitionSpec), currentHashCode, theTimePartitionSpec);