Package org.kitesdk.data.hbase

Examples of org.kitesdk.data.hbase.HBaseDatasetRepository


  @BeforeClass
  public static void beforeClass() throws Exception {
    HBaseTestUtils.getMiniCluster();
    // managed table should be created by HBaseDatasetRepository
    HBaseTestUtils.util.deleteTable(Bytes.toBytes(managedTableName));
    HBaseDatasetRepository repo = new HBaseDatasetRepository.Builder()
        .configuration(HBaseTestUtils.getConf()).build();
    String testGenericEntity = AvroUtils.inputStreamToString(
        HBaseDatasetRepositoryTest.class.getResourceAsStream("/TestGenericEntity.avsc"));
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaLiteral(testGenericEntity)
        .build();
    dataset = repo.create("default", "testtable", descriptor);
    for (int i = 0; i < 10; i++) {
      dataset.put(HBaseDatasetRepositoryTest.createGenericEntity(i));
    }
  }
View Full Code Here


  }

  @Test
  public void testSpecific() throws Exception {

    HBaseDatasetRepository repo = new HBaseDatasetRepository.Builder()
        .configuration(HBaseTestUtils.getConf()).build();

    // create constituent datasets
    repo.create("default", tableName + ".SubEntity1", new DatasetDescriptor.Builder()
        .schema(SubEntity1.SCHEMA$)
        .build());
    repo.create("default", tableName + ".SubEntity2", new DatasetDescriptor.Builder()
        .schema(SubEntity2.SCHEMA$)
        .build());

    // create composite dataset
    RandomAccessDataset<Map<String, SpecificRecord>> ds = repo.load(
        "default", tableName + ".SubEntity1.SubEntity2");

    // Construct entities
    SubEntity1 subEntity1 = SubEntity1.newBuilder().setPart1("1").setPart2("1")
        .setField1("field1_1").setField2("field1_2").build();
View Full Code Here

    if (admin.tableExists("kite_example_user_profiles")) {
      admin.disableTable("kite_example_user_profiles");
      admin.deleteTable("kite_example_user_profiles");
    }

    HBaseDatasetRepository repo = new HBaseDatasetRepository.Builder()
        .configuration(conf).build();

    // TODO: change to use namespace (CDK-140)

    DatasetDescriptor userProfileDatasetDescriptor =
        new DatasetDescriptor.Builder().schema(UserProfileModel2.SCHEMA$).build();
    userProfileDataset = repo.create("default", "kite_example_user_profiles.UserProfileModel2",
        userProfileDatasetDescriptor);

    DatasetDescriptor userActionsDatasetDescriptor =
        new DatasetDescriptor.Builder().schema(UserActionsModel2.SCHEMA$).build();
    userActionsDataset = repo.create("default", "kite_example_user_profiles.UserActionsModel2",
        userActionsDatasetDescriptor);

    DatasetDescriptor userProfileActionsDatasetDescriptor =
        new DatasetDescriptor.Builder().schema(UserProfileActionsModel2.SCHEMA$).build();
    userProfileActionsDataset = repo.create("default", "kite_example_user_profiles.UserProfileActionsProtocol2",
        userProfileActionsDatasetDescriptor);

  }
View Full Code Here

TOP

Related Classes of org.kitesdk.data.hbase.HBaseDatasetRepository

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.