Package org.kiji.schema

Examples of org.kiji.schema.KijiDataRequest$Column


    assertEquals(spec, spec2);
  }

  @Test
  public void testColumnOverride() throws IOException {
    final KijiDataRequest normalRequest =
        KijiDataRequest.create(EMPTY.getFamily(), EMPTY.getQualifier());
    final KijiDataRequest overrideRequest = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
        .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
View Full Code Here


    }
  }

  @Test
  public void testFailOnOverride() throws IOException {
    final KijiDataRequest request = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
        .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
View Full Code Here

    }
  }

  @Test
  public void testOverrideAtConstruction() throws IOException {
    final KijiDataRequest normalRequest =
        KijiDataRequest.create(EMPTY.getFamily(), EMPTY.getQualifier());
    final KijiDataRequest overrideRequest = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
        .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
View Full Code Here

    }
  }

  @Test
  public void testAlternative() throws IOException {
    final KijiDataRequest normalRequest =
        KijiDataRequest.create(EMPTY.getFamily(), EMPTY.getQualifier());
    final KijiDataRequest overrideRequest = KijiDataRequest.builder()
        .addColumns(ColumnsDef.create()
            .add(EMPTY, ColumnReaderSpec.avroReaderSchemaSpecific(TestRecord1.class))).build();

    final KijiTable table = getKiji().openTable("table");
    try {
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public <U extends T> KijiResult<U> narrowView(final KijiColumnName column) {
    final KijiDataRequest narrowRequest = DefaultKijiResult.narrowRequest(column, mDataRequest);

    return new CassandraPagedKijiResult<U>(
        mEntityId,
        narrowRequest,
        mTable,
View Full Code Here

  public void testTimeToLive() throws Exception {

    // TTL is 10 seconds for this cell.
    mWriter.put(mEntityId, FAMILY, QUALIFIER, TIMESTAMP, VALUE);

    final KijiDataRequest dataRequest = KijiDataRequest.create(FAMILY, QUALIFIER);

    // The data should be there now!
    KijiRowData rowData = mReader.get(mEntityId, dataRequest);
    String s = rowData.getValue(FAMILY, QUALIFIER, TIMESTAMP).toString();
    assertEquals(s, VALUE);
View Full Code Here

    final KijiTable table = kiji.openTable("table");
    try {
      final KijiTableReader reader = table.getReaderFactory().openTableReader();
      try {
        final EntityId eid = table.getEntityId("row");
        final KijiDataRequest dataRequest = KijiDataRequest.builder()
            .addColumns(ColumnsDef.create().addFamily("family"))
            .build();
        final KijiRowData row = reader.get(eid, dataRequest);
        assertEquals(
            Schema.Type.STRING,
View Full Code Here

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

      final KijiDataRequest dataRequest = KijiDataRequest.builder()
          .addColumns(ColumnsDef.create().addFamily("family"))
          .build();

      final KijiTableReader reader = table.openTableReader();
      try {
View Full Code Here

      }

      // Read the record back (should be a generic record):
      final KijiTableReader reader = table.openTableReader();
      try {
        final KijiDataRequest dataRequest = KijiDataRequest.builder()
            .addColumns(ColumnsDef.create().add("family", "qualifier"))
            .build();
        final KijiRowData row = reader.get(table.getEntityId("eid"), dataRequest);
        final GenericData.Record record = row.getValue("family", "qualifier", 1L);
        assertEquals(writerSchema, record.getSchema());
View Full Code Here

    }

    final CellDecoderProvider requestDecoderProvider =
        decoderProvider.getDecoderProviderForRequest(dataRequest);

    final KijiDataRequest unpagedRequest = unpagedRequestBuilder.build();
    final KijiDataRequest pagedRequest = pagedRequestBuilder.build();

    if (unpagedRequest.isEmpty() && pagedRequest.isEmpty()) {
      return new EmptyKijiResult<T>(entityId, dataRequest);
    }

    final MaterializedKijiResult<T> materializedKijiResult;
    if (!unpagedRequest.isEmpty()) {
      materializedKijiResult =
          createMaterialized(
              table.getURI(),
              entityId,
              unpagedRequest,
              layout,
              columnTranslator,
              requestDecoderProvider,
              table.getAdmin());
    } else {
      materializedKijiResult = null;
    }

    final CassandraPagedKijiResult<T> pagedKijiResult;
    if (!pagedRequest.isEmpty()) {
      pagedKijiResult =
          new CassandraPagedKijiResult<T>(
              entityId,
              pagedRequest,
              table,
              layout,
              columnTranslator,
              requestDecoderProvider);
    } else {
      pagedKijiResult = null;
    }

    if (unpagedRequest.isEmpty()) {
      return pagedKijiResult;
    } else if (pagedRequest.isEmpty()) {
      return materializedKijiResult;
    } else {
      return DefaultKijiResult.create(dataRequest, materializedKijiResult, pagedKijiResult);
    }
  }
View Full Code Here

TOP

Related Classes of org.kiji.schema.KijiDataRequest$Column

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.