Package com.cloudera.cdk.data.hbase.avro.entities

Examples of com.cloudera.cdk.data.hbase.avro.entities.SubRecord1


        compositeTableName, CompositeRecord.class, manager);
    Dao<SubRecord1> subRecord1Dao = new SpecificAvroDao<SubRecord1>(tablePool, compositeTableName, "SubRecord1", manager);
    Dao<SubRecord2> subRecord2Dao = new SpecificAvroDao<SubRecord2>(tablePool, compositeTableName, "SubRecord2", manager);

    // Construct records
    SubRecord1 subRecord1 = SubRecord1.newBuilder().setKeyPart1("1")
        .setKeyPart2("1").setField1("field1_1").setField2("field1_2").build();
    SubRecord2 subRecord2 = SubRecord2.newBuilder().setKeyPart1("1")
        .setKeyPart2("1").setField1("field2_1").setField2("field2_2").build();

    CompositeRecord compositeRecord = CompositeRecord.newBuilder()
        .setSubRecord1(subRecord1).setSubRecord2(subRecord2).build();

    // Test put
    assertTrue(dao.put(compositeRecord));
   
    // validate deleting one of the records doesn't delete the entire row
    PartitionKey key = dao.getPartitionStrategy().partitionKey("1", "1");
    subRecord2Dao.delete(key);
    subRecord1 = subRecord1Dao.get(key);
    assertNotNull(subRecord1);
    assertNull(subRecord2Dao.get(key));
   
    // validate the _s columns (like OCCVersion fields) weren't messed with
    assertEquals(1L, (long)subRecord1.getVersion());
   
    // validate fetching as composite after a delete of one still works.
    compositeRecord = dao.get(key);
    assertNotNull(compositeRecord.getSubRecord1());
    assertNull(compositeRecord.getSubRecord2());
View Full Code Here


    Dao<CompositeRecord> dao = SpecificAvroDao.buildCompositeDao(tablePool,
        tableName, Arrays.asList(subRecord1String, subRecord2String),
        CompositeRecord.class);

    // Construct records
    SubRecord1 subRecord1 = SubRecord1.newBuilder().setKeyPart1("1")
        .setKeyPart2("1").setField1("field1_1").setField2("field1_2").build();
    SubRecord2 subRecord2 = SubRecord2.newBuilder().setKeyPart1("1")
        .setKeyPart2("1").setField1("field2_1").setField2("field2_2").build();

    CompositeRecord compositeRecord = CompositeRecord.newBuilder()
View Full Code Here

    Dao<Map<String, SpecificRecord>> dao = SpecificAvroDao.buildCompositeDao(
        tablePool, tableName,
        Arrays.asList(subRecord1String, subRecord2String));

    // Construct records and keys
    SubRecord1 subRecord1 = SubRecord1.newBuilder().setKeyPart1("1").setKeyPart2("1").setField1("field1_1")
        .setField2("field1_2").build();
    SubRecord2 subRecord2 = SubRecord2.newBuilder().setKeyPart1("1").setKeyPart2("1").setField1("field2_1")
        .setField2("field2_2").build();

    Map<String, SpecificRecord> compositeRecord = new HashMap<String, SpecificRecord>();
View Full Code Here

    Dao<Map<String, SpecificRecord>> dao = SpecificAvroDao.buildCompositeDao(
        tablePool, tableName,
        Arrays.asList(subRecord1String, subRecord2String));
   
    // Construct records and keys
    SubRecord1 subRecord1 = SubRecord1.newBuilder().setKeyPart1("1").setKeyPart2("1").setField1("field1_1")
        .setField2("field1_2").build();
    SubRecord2 subRecord2 = SubRecord2.newBuilder().setKeyPart1("1").setKeyPart2("unmatched").setField1("field2_1")
        .setField2("field2_2").build();

    Map<String, SpecificRecord> compositeRecord = new HashMap<String, SpecificRecord>();
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.hbase.avro.entities.SubRecord1

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.