Package org.kiji.schema.avro

Examples of org.kiji.schema.avro.TableLayoutDesc


  public void testReadDeletedColumns() throws Exception {
    final EntityId eid = mTable.getEntityId("eid");
    mWriter.put(eid, FAMILY, QUALIFIER_0, 1L, "string1");
    mWriter.put(eid, FAMILY, QUALIFIER_0, 2L, "string2");

    final TableLayoutDesc update = KijiTableLayouts.getLayout(TEST_LAYOUT_V2);
    update.setReferenceLayout(mTable.getLayout().getDesc().getLayoutId());
    mKiji.modifyTableLayout(update);

    final KijiDataRequest dataRequest = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create().addFamily(FAMILY))
        .build();
View Full Code Here


  @Test
  public void testKijiScanStartAndLimitRow() throws Exception {
    final Kiji kiji = getKiji();

    TableLayoutDesc desc = KijiTableLayouts.getLayout(KijiTableLayouts.FOO_TEST);
    ((RowKeyFormat2)desc.getKeysFormat()).setEncoding(RowKeyEncoding.RAW);

    final KijiTableLayout layout =  KijiTableLayout.newLayout(desc);
    final long timestamp = 10L;
    new InstanceBuilder(kiji)
        .withTable(layout.getName(), layout)
View Full Code Here

        Schema.createEnum("Gender", null, null, ImmutableList.of("MALE", "FEMALE", "BOTH"));

    final KijiTable table = kiji.openTable(TABLE_NAME);
    try {

      final TableLayoutDesc updateWithReader =
          new TableLayoutBuilder(table.getLayout().getDesc(), kiji)
              .withReader(KijiColumnName.create("info""gender"), readerEnum)
              .build();
      LOG.debug("Applying update with enum reader: %s", updateWithReader);
      kiji.modifyTableLayout(updateWithReader);

      final TableLayoutDesc updateWithWriter=
          new TableLayoutBuilder(table.getLayout().getDesc(), kiji)
              .withWriter(KijiColumnName.create("info""gender"), writerEnum)
              .build();
      LOG.debug("Applying update with enum writer: %s", updateWithWriter);
      try {
View Full Code Here

    mDataRequest = builder.build();

    mKiji = Kiji.Factory.open(getKijiURI(), getConf());

    LOG.info("Creating test table.");
    final TableLayoutDesc layout = KijiTableLayouts.getLayout(KijiTableLayouts.DELETES_TEST);
    mKiji.createTable(layout);

    LOG.info("Populating test table.");
    mTable = mKiji.openTable(layout.getName());
    mWriter = mTable.openTableWriter();
    mWriter.put(mTable.getEntityId("alpha"), "group", "a", 1L, "1");
    mWriter.put(mTable.getEntityId("alpha"), "group", "a", 2L, "2");
    mWriter.put(mTable.getEntityId("alpha"), "group", "a", 3L, "3");
    mWriter.put(mTable.getEntityId("alpha"), "group", "b", 3L, "3");
View Full Code Here

  /** Only deep copies should be mutated by TableLayoutBuilder. */
  @Test
  public void testTableLayoutSafeMutation() throws IOException {
    final KijiTableLayout layout = KijiTableLayouts.getTableLayout(TEST_LAYOUT);
    final TableLayoutDesc tld = layout.getDesc();
    final TableLayoutBuilder tlb = new TableLayoutBuilder(tld, getKiji());
    tld.setName("blastoise");
    final TableLayoutDesc tldBuilt = tlb.build();
    assertFalse(tld.getName().equals(tldBuilt.getName()));
  }
View Full Code Here

  public static final String SIMPLE_MAP_TYPE =
      "org/kiji/schema/layout/simple-map-type.json";

  /** Test layout with hashing disabled. */
  public static TableLayoutDesc getFooUnhashedTestLayout() throws IOException {
    final TableLayoutDesc desc = getLayout(FOO_TEST_LEGACY);
    desc.setName("foo_nonhashed");
    ((RowKeyFormat)desc.getKeysFormat()).setEncoding(RowKeyEncoding.RAW);
    return desc;
  }
View Full Code Here

    return desc;
  }

  /** Test changing the row key hashing property. */
  public static TableLayoutDesc getFooChangeHashingTestLayout() throws IOException {
    final TableLayoutDesc desc = getLayout(FOO_TEST_LEGACY);
    ((RowKeyFormat)desc.getKeysFormat()).setEncoding(RowKeyEncoding.RAW);
    desc.setReferenceLayout("1");
    return desc;
  }
View Full Code Here

  @Test
  public void testSetTableLayoutModify() throws Exception {
    getKiji().createTable(mLayoutDesc);

    final TableLayoutDesc newTableLayoutDesc = TableLayoutDesc.newBuilder(mLayoutDesc).build();
    assertEquals(3, (int) newTableLayoutDesc.getLocalityGroups().get(0).getMaxVersions());
    newTableLayoutDesc.getLocalityGroups().get(0).setMaxVersions(1);
    newTableLayoutDesc.setReferenceLayout(getLayout("table").getDesc().getLayoutId());

    final KijiTableLayout newTableLayout = getKiji().modifyTableLayout(newTableLayoutDesc);
    assertEquals(
        newTableLayout.getLocalityGroupMap().get("default").getDesc().getMaxVersions(),
        getLayout("table").getLocalityGroupMap().get("default").getDesc().getMaxVersions());
View Full Code Here

    }
  }

  @Test
  public void testSetTableLayoutOnATableThatDoesNotExist() throws Exception {
    final TableLayoutDesc tableLayoutDesc = KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE);
    try {
      getKiji().modifyTableLayout(tableLayoutDesc);
      fail("An exception should have been thrown.");
    } catch (KijiTableNotFoundException ktnfe) {
      assertTrue(ktnfe.getMessage().startsWith("KijiTable not found: kiji://"));
View Full Code Here

  public void testStrictWrite() throws Exception {
    final Kiji kiji = getKiji();
    final long writerUID = kiji.getSchemaTable().getOrCreateSchemaId(STRING_SCHEMA);

    // Setup table layout with pre-registered writer schemas.
    final TableLayoutDesc layoutDesc = KijiTableLayouts.getLayout(KijiTableLayouts.FULL_FEATURED);
    final CellSchema cellSchema = layoutDesc
            .getLocalityGroups().get(0)
            .getFamilies().get(0)
            .getColumns().get(0)
            .getColumnSchema();
    cellSchema.setWriters(Lists.newArrayList(AvroSchema.newBuilder().setUid(writerUID).build()));
    cellSchema.setType(SchemaType.AVRO);
    cellSchema.setAvroValidationPolicy(AvroValidationPolicy.STRICT);
    layoutDesc.setVersion("layout-1.3");
    kiji.createTable(layoutDesc);

    final KijiTable table = kiji.openTable("user");
    try {
      final KijiTableWriter writer = table.openTableWriter();
View Full Code Here

TOP

Related Classes of org.kiji.schema.avro.TableLayoutDesc

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.