Examples of CellSpec


Examples of org.kiji.schema.layout.CellSpec

    assertArrayEquals(Bytes.toBytes(3181L), encoder.encode(3181L));
  }

  @Test
  public void testEncodeAvroInline() throws IOException {
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setStorage(SchemaStorage.FINAL)
            .setType(SchemaType.INLINE)
            .setValue("\"long\"")
            .build());
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    assertArrayEquals(new byte[]{-38, 49}, encoder.encode(3181L));
  }

  @Test
  public void testEncodeAvroClass() throws IOException {
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setStorage(SchemaStorage.FINAL)
            .setType(SchemaType.CLASS)
            .setValue(TestRecord.class.getName())
            .build());
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    assertArrayEquals(new byte[]{2, 97, 2, 4}, encoder.encode(record));
  }

  @Test
  public void testEncodeAvroSchemaUID() throws IOException {
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setStorage(SchemaStorage.UID)
            .setType(SchemaType.INLINE)
            .setValue("\"long\"")
            .build())
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    assertArrayEquals(new byte[]{3, -38, 49}, encoder.encode(3181L));
  }

  @Test
  public void testEncodeAvroSchemaHash() throws IOException {
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setStorage(SchemaStorage.HASH)
            .setType(SchemaType.INLINE)
            .setValue("\"long\"")
            .build())
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

   * schema can be inferred for the specified value to encode.
   */
  @Test
  public void testWriterSchemaNotInferrable() throws IOException {
    final Kiji kiji = getKiji();
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setType(SchemaType.AVRO)
            .setAvroValidationPolicy(AvroValidationPolicy.DEVELOPER)
            .build())
        .setSchemaTable(kiji.getSchemaTable());
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

/** Tests for Kiji cell decoders. */
public class TestKijiCellDecoder extends KijiClientTest {
  @Test
  public void testDecodeCounter() throws IOException {
    final CellSpec cellSpec = CellSpec.newCounter();
    final KijiCellEncoder encoder = DefaultKijiCellEncoderFactory.get().create(cellSpec);
    final KijiCellDecoder<Long> decoder = SpecificCellDecoderFactory.get().create(cellSpec);
    assertEquals(3181L, (long) decoder.decodeValue(encoder.encode(3181L)));
  }
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    final KijiCellDecoder<Long> decoder = SpecificCellDecoderFactory.get().create(cellSpec);
    assertEquals(3181L, (long) decoder.decodeValue(encoder.encode(3181L)));
  }

  private void testDecodeAvroSchema(SchemaStorage storage) throws IOException {
    final CellSpec cellSpec = CellSpec.create()
        .setCellSchema(CellSchema.newBuilder()
            .setType(SchemaType.CLASS)
            .setValue(Node.class.getName())
            .setStorage(storage)
            .build())
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    mTableLayout =
        KijiTableLayouts.getTableLayout(KijiTableLayouts.SIMPLE_UPDATE_NEW_COLUMN);
    getKiji().createTable(mTableLayout.getDesc());

    mColumnNameTranslator = HBaseColumnNameTranslator.from(mTableLayout);
    final CellSpec cellSpec = mTableLayout.getCellSpec(KijiColumnName.create("family", "new"))
        .setSchemaTable(getKiji().getSchemaTable());
    mCellEncoder = DefaultKijiCellEncoderFactory.get().create(cellSpec);

    mHBaseFilter = new SingleColumnValueFilter(
        Bytes.toBytes("family"), Bytes.toBytes("new"), CompareOp.NO_OP, new byte[0]);
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

    /** {@inheritDoc} */
    @Override
    public byte[] getHBaseCellValue(KijiColumnName column, DecodedCell<?> kijiCell)
        throws IOException {
      final CellSpec cellSpec = mColumnNameTranslator.getTableLayout().getCellSpec(column)
          .setSchemaTable(mSchemaTable);
      final KijiCellEncoder encoder = DefaultKijiCellEncoderFactory.get().create(cellSpec);
      return encoder.encode(kijiCell);
    }
View Full Code Here

Examples of org.kiji.schema.layout.CellSpec

      throws IOException {
    mKijiURI = kijiURI;
    mMetaTableName = CassandraTableName.getMetaLayoutTableName(kijiURI);
    mAdmin = admin;
    mSchemaTable = Preconditions.checkNotNull(schemaTable);
    final CellSpec cellSpec = CellSpec.fromCellSchema(CELL_SCHEMA, mSchemaTable);
    mCellEncoder = new AvroCellEncoder(cellSpec);
    mCellDecoder = SpecificCellDecoderFactory.get().create(cellSpec);
    mGetRowsStatement = getGetRowsStatement();
    mRemoveAllTableLayoutVersionsStatement = getRemoveAllTableLayoutVersionsStatement();
    mUpdateTableLayoutStatement = getUpdateTableLayoutStatement();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.