@Override public boolean initFromProperties(Map<String, String> properties) throws LensException { allPartitions.clear(); String partitionsStr = MetastoreUtil.getNamedStringValue(properties, "partitions"); if (partitionsStr == null) { return true; } for (String s : StringUtils.split(partitionsStr, ",")) { add(TimePartition.of(getUpdatePeriod(), s)); } return true; }
@Override public Iterator<TimePartition> iterator() { return getAllPartitions().iterator(); } }
List<String> partitions = Lists.newArrayList(); StoreAllPartitionTimeline ttdStoreAll = new StoreAllPartitionTimeline(MetastoreUtil.getFactOrDimtableStorageTableName(fact.getName(), c4), HOURLY, "ttd"); StoreAllPartitionTimeline ttd2StoreAll = new StoreAllPartitionTimeline(MetastoreUtil.getFactOrDimtableStorageTableName(fact.getName(), c4), HOURLY, "ttd2"); while (!(temp.after(NOW))) { timeParts.put("ttd2", temp); TimePartition tp = TimePartition.of(HOURLY, temp); ttdStoreAll.add(tp); ttd2StoreAll.add(tp); partitions.add(HOURLY.format(temp)); StoragePartitionDesc sPartSpec = new StoragePartitionDesc(fact.getName(), timeParts, null, HOURLY);
@Override public boolean initFromProperties(Map<String, String> properties) throws LensException { allPartitions.clear(); String partitionsStr = MetastoreUtil.getNamedStringValue(properties, "partitions"); if (partitionsStr == null) { return true; } for (String s : StringUtils.split(partitionsStr, ",")) { add(TimePartition.of(getUpdatePeriod(), s)); } return true; }
@Override public Iterator<TimePartition> iterator() { return getAllPartitions().iterator(); } }
private void assertTimeline(EndsAndHolesPartitionTimeline endsAndHolesPartitionTimeline, StoreAllPartitionTimeline storeAllPartitionTimeline, UpdatePeriod updatePeriod, Date first, Date latest, Date... holes) throws LensException { TimePartition firstPart = TimePartition.of(updatePeriod, first); TimePartition latestPart = TimePartition.of(updatePeriod, latest); assertEquals(endsAndHolesPartitionTimeline.getFirst(), firstPart); assertEquals(endsAndHolesPartitionTimeline.getLatest(), TimePartition.of(updatePeriod, latest)); assertEquals(endsAndHolesPartitionTimeline.getHoles().size(), holes.length); for (Date date : holes) { assertTrue(endsAndHolesPartitionTimeline.getHoles().contains(TimePartition.of(updatePeriod, date))); } TreeSet<TimePartition> partitions = new TreeSet<>(); for (Date dt : TimeRange.iterable(firstPart.getDate(), latestPart.next().getDate(), updatePeriod, 1)) { partitions.add(TimePartition.of(updatePeriod, dt)); } for (Date holeDate : holes) { partitions.remove(TimePartition.of(updatePeriod, holeDate)); } assertEquals(storeAllPartitionTimeline.getAllPartitions(), partitions); }