@Test
  public void testUnbounded() throws Exception {
    Iterable<StorageKey> partitions =
        new FileSystemPartitionIterator(
            fileSystem, testDirectory, strategy, schema, emptyConstraints.toKeyPredicate());

    assertIterableEquals(keys, partitions);
  }
 @Test
 public void testLargerRange() throws Exception {
   Predicate<StorageKey> predicate =
       emptyConstraints
           .from("timestamp", oct_25_2012)
           .to("timestamp", oct_24_2013)
           .toKeyPredicate();
   Iterable<StorageKey> partitions =
       new FileSystemPartitionIterator(fileSystem, testDirectory, strategy, schema, predicate);
   assertIterableEquals(keys.subList(5, 17), partitions);
 }
 @Test
 public void testWith() throws Exception {
   Iterable<StorageKey> partitions =
       new FileSystemPartitionIterator(
           fileSystem,
           testDirectory,
           strategy,
           schema,
           emptyConstraints.with("timestamp", oct_24_2013).toKeyPredicate());
   assertIterableEquals(keys.subList(16, 17), partitions);
 }
Ejemplo n.º 4
0
 @Override
 public void initialize() {
   if (key == null) {
     // restore transient objects from serializable versions
     PartitionStrategy strategy = PartitionStrategyParser.parse(strategyString);
     Schema schema = new Schema.Parser().parse(schemaString);
     this.key = new AvroStorageKey(strategy, schema);
     this.accessor = DataModelUtil.accessor(type, schema);
     if (constraints != null) {
       this.provided =
           Constraints.fromQueryMap(schema, strategy, constraints).getProvidedValues();
     }
   }
 }
Ejemplo n.º 5
0
 @SuppressWarnings("unchecked")
 private static <E, V extends View<E>> V view(Dataset<E> dataset, Map<String, String> uriOptions) {
   if (dataset instanceof AbstractDataset) {
     DatasetDescriptor descriptor = dataset.getDescriptor();
     Schema schema = descriptor.getSchema();
     PartitionStrategy strategy = null;
     if (descriptor.isPartitioned()) {
       strategy = descriptor.getPartitionStrategy();
     }
     Constraints constraints = Constraints.fromQueryMap(schema, strategy, uriOptions);
     return (V) ((AbstractDataset) dataset).filter(constraints);
   } else {
     return (V) dataset;
   }
 }