Package com.cloudera.cdk.data

Examples of com.cloudera.cdk.data.PartitionKey


    return returnList;
  }

  @Override
  public ManagedSchema getManagedSchema(String tableName, String entityName) {
    PartitionKey key = managedSchemaDao.getPartitionStrategy().partitionKey(
        tableName, entityName);
    ManagedSchema managedSchemaRecord = managedSchemaDao.get(key);
    if (managedSchemaRecord == null) {
      return null;
    } else {
View Full Code Here


        .setSubRecord1(subRecord1).setSubRecord2(subRecord2).build();

    // Test put and get
    dao.put(compositeRecord);

    PartitionKey key = dao.getPartitionStrategy().partitionKey("1", "1");
    CompositeRecord returnedCompositeRecord = dao.get(key);
    assertEquals("field1_1", returnedCompositeRecord.getSubRecord1()
        .getField1());
    assertEquals("field1_2", returnedCompositeRecord.getSubRecord1()
        .getField2());
View Full Code Here

    compositeRecord.put("SubRecord1", subRecord1);
    compositeRecord.put("SubRecord2", subRecord2);

    // Test put and get
    dao.put(compositeRecord);
    PartitionKey key = dao.getPartitionStrategy().partitionKey("1", "1");
    Map<String, SpecificRecord> returnedCompositeRecord = dao.get(key);
    assertEquals("field1_1", ((SubRecord1) returnedCompositeRecord.get("SubRecord1"))
        .getField1());
    assertEquals("field1_2", ((SubRecord1) returnedCompositeRecord.get("SubRecord1"))
        .getField2());
View Full Code Here

    possibleValues.add("field1_20");
    possibleValues.add("field1_21");
    possibleValues.add("field1_22");
    possibleValues.add("field1_23");
    possibleValues.add("field1_24");
    PartitionKey startKey = dao.getPartitionStrategy().partitionKey("part1_20",
        "part2_20");
    PartitionKey stopKey = dao.getPartitionStrategy().partitionKey("part1_25",
        "part2_25");

    EntityScannerBuilder<GenericRecord> builder = dao.getScannerBuilder()
        .setStartKey(startKey).setStopKey(stopKey);
View Full Code Here

    Dataset<Record> outputDataset = repo.create("out", new DatasetDescriptor.Builder()
        .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build());

    writeTestUsers(inputDataset, 10);

    PartitionKey key = partitionStrategy.partitionKey(0);
    Dataset<Record> inputPart0 = inputDataset.getPartition(key, false);
    Dataset<Record> outputPart0 = outputDataset.getPartition(key, true);

    Pipeline pipeline = new MRPipeline(TestCrunchDatasets.class);
    PCollection<GenericData.Record> data = pipeline.read(
View Full Code Here

    Dataset<GenericRecord> users = repo.load("users");

    // Get the partition strategy and use it to construct a partition key for
    // hash(username)=0
    PartitionStrategy partitionStrategy = users.getDescriptor().getPartitionStrategy();
    PartitionKey partitionKey = partitionStrategy.partitionKey(0);

    // Get the dataset partition for the partition key
    Dataset<GenericRecord> partition = users.getPartition(partitionKey, false);

    // Get a reader for the partition and read all the users
View Full Code Here

    }
    return ds;
  }

  private <E> Dataset<E> getPartitionForURI(Dataset<E> eventsDataset, String uri) {
    PartitionKey partitionKey = FileSystemDatasetRepository.partitionKeyForPath(
        eventsDataset, URI.create(uri));
    Dataset<E> partition = eventsDataset.getPartition(partitionKey, false);
    if (partition == null) {
      throw new IllegalArgumentException("Partition not found: " + uri);
    }
View Full Code Here

    final DatasetWriter<GenericRecord> writer = persistent.newWriter();
    writer.open();

    // the source dataset: yesterday's partition in the staging area
    final Dataset<GenericRecord> staging = repo.load("logs-staging");
    final PartitionKey yesterday = getPartitionKey(staging, yesterdayTimestamp);
    final DatasetReader<GenericRecord> reader = staging
        .getPartition(yesterday, false).newReader();

    try {
      reader.open();
View Full Code Here

    }
    return ds;
  }

  private <E> Dataset<E> getPartitionForURI(Dataset<E> eventsDataset, String uri) {
    PartitionKey partitionKey = FileSystemDatasetRepository.partitionKeyForPath(
        eventsDataset, URI.create(uri));
    Dataset<E> partition = eventsDataset.getPartition(partitionKey, false);
    if (partition == null) {
      throw new IllegalArgumentException("Partition not found: " + uri);
    }
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.PartitionKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.