Package org.kiji.schema

Examples of org.kiji.schema.KijiDataRequestBuilder$ColumnsDef


    testViewGet(request, column1Entries);
  }

  @Test
  public void testGetMatContents() throws Exception {
    KijiDataRequestBuilder builder = KijiDataRequest.builder().addColumns(ColumnsDef.create()
            .withMaxVersions(10)
            .add(PRIMITIVE_STRING, null)
            .add(STRING_MAP_1, null));
    KijiDataRequest request = builder.build();
    final EntityId eid = mTable.getEntityId(ROW);
    KijiResult<Object> view = mReader.getResult(eid, request);
    SortedMap<KijiColumnName, List<KijiCell<Object>>> map =
        KijiResult.Helpers.getMaterializedContents(view);
    for (KijiColumnName col: map.keySet()) {
View Full Code Here


        .create()
        .withFilter(mColumnRequest.getFilter())
        .withPageSize(KijiDataRequest.PAGING_DISABLED)
        .withMaxVersions(mColumnRequest.getMaxVersions())
        .add(column, mColumnRequest.getReaderSpec());
    final KijiDataRequestBuilder dataRequest = KijiDataRequest.builder();
    dataRequest.addColumns(columnDef);

    final List<KijiCell<Object>> cells =
        ImmutableList.copyOf(Iterators.limit(mCells, pageSize));
    final KijiResult<Object> result = MaterializedKijiResult.create(
        mResult.getEntityId(),
        dataRequest.build(),
        mLayout,
        ImmutableSortedMap.<KijiColumnName, List<KijiCell<Object>>>naturalOrder()
            .put(column, cells)
            .build());
    return new KijiResultRowData(mLayout, result);
View Full Code Here

  }

  @Test
  public void testDeleteMostRecentCellInColumnFromRow() throws Exception {
    setupTableAndReader();
    final KijiDataRequestBuilder kdrb = KijiDataRequest.builder();
    kdrb.newColumnsDef().withMaxVersions(HConstants.ALL_VERSIONS)
        .add("family", "column");
    final KijiDataRequest kdr = kdrb.build();
    final KijiRowData rowBefore =
        mReader.get(mTable.getEntityId("row-1"), kdr);
    assertEquals(3, rowBefore.getValues("family", "column").size());
    assertEquals(315L, (long) rowBefore.getValues("family", "column").firstKey());
View Full Code Here

  }

  @Test
  public void testDeleteExactTimestampCellInColumnFromRow() throws Exception {
    setupTableAndReader();
    final KijiDataRequestBuilder kdrb = KijiDataRequest.builder();
    kdrb.newColumnsDef().withMaxVersions(HConstants.ALL_VERSIONS)
        .add("family", "column");
    final KijiDataRequest kdr = kdrb.build();
    final KijiRowData rowBefore =
        mReader.get(mTable.getEntityId("row-1"), kdr);
    assertEquals(3, rowBefore.getValues("family", "column").size());
    assertEquals(315L, (long) rowBefore.getValues("family", "column").firstKey());
View Full Code Here

  }

  @Test
  public void testDeleteUpToTimestampCellInColumnFromRow() throws Exception {
    setupTableAndReader();
    final KijiDataRequestBuilder kdrb = KijiDataRequest.builder();
    kdrb.newColumnsDef().withMaxVersions(HConstants.ALL_VERSIONS)
        .add("family", "column");
    final KijiDataRequest kdr = kdrb.build();
    final KijiRowData rowBefore =
        mReader.get(mTable.getEntityId("row-1"), kdr);
    assertEquals(3, rowBefore.getValues("family", "column").size());
    assertEquals(315L, (long) rowBefore.getValues("family", "column").firstKey());
View Full Code Here

    writer.put(id, "info", "name", 3L, "me-three");
    writer.put(id, "info", "name", 4L, "me-four");
    writer.put(id, "info", "name", 5L, "me-five");
    ResourceUtils.closeOrLog(writer);
    final KijiColumnFilter columnFilter = new KijiPaginationFilter(1);
    final KijiDataRequestBuilder builder = KijiDataRequest.builder();
    builder.newColumnsDef().withMaxVersions(5).withFilter(columnFilter).add("info", "name");
    final KijiDataRequest dataRequest = builder.build();
    EntityId meId = mTable.getEntityId(Bytes.toBytes("me"));
    KijiRowData myRowData = mReader.get(meId, dataRequest);
    final NavigableMap<Long, CharSequence> resultMap = myRowData.getValues("info", "name");
    assertEquals("The number of returned values is incorrect:", 1, resultMap.size());
    assertTrue(null != resultMap.get(5L));
View Full Code Here

    writer.put(id, "info", "name", 3L, "me-three");
    writer.put(id, "info", "name", 4L, "me-four");
    writer.put(id, "info", "name", 5L, "me-five");
    ResourceUtils.closeOrLog(writer);
    final KijiColumnFilter columnFilter = new KijiPaginationFilter(1);
    final KijiDataRequestBuilder builder = KijiDataRequest.builder();
    builder.newColumnsDef().withMaxVersions(5).withFilter(columnFilter).add("info", "name");
    final KijiDataRequest dataRequest = builder.build();
    EntityId meId = mTable.getEntityId("me");
    KijiRowData myRowData = mReader.get(meId, dataRequest);
    final NavigableMap<Long, CharSequence> resultMap = myRowData.getValues("info", "name");
    assertEquals("The number of returned values is incorrect:", 1, resultMap.size());
    assertTrue(null != resultMap.get(5L));
View Full Code Here

    writer.put(id, "jobs", "c", 3L, "always coming in 3rd");
    writer.put(id, "jobs", "b", 4L, "always coming in 2nd");
    writer.put(id, "jobs", "a", 5L, "always coming in 1st");
    ResourceUtils.closeOrLog(writer);
    final KijiColumnFilter columnFilter = new KijiPaginationFilter(1);
    final KijiDataRequestBuilder builder = KijiDataRequest.builder();
    builder.newColumnsDef().withMaxVersions(5).withFilter(columnFilter).addFamily("jobs");
    final KijiDataRequest dataRequest = builder.build();
    EntityId meId = mTable.getEntityId(Bytes.toBytes("me"));
    KijiRowData myRowData = mReader.get(meId, dataRequest);
    final NavigableMap<String, NavigableMap<Long, CharSequence>> resultMap
        = myRowData.<CharSequence>getValues("jobs");
    assertEquals("The number of returned values is incorrect:", 1, resultMap.size());
View Full Code Here

    writer.put(id, "jobs", "a", 4L, "always coming in 2nd");
    writer.put(id, "jobs", "a", 5L, "always coming in 1st");
    ResourceUtils.closeOrLog(writer);
    final KijiColumnFilter columnFilter =
        new KijiPaginationFilter(new RegexQualifierColumnFilter("b"), 1);
    final KijiDataRequestBuilder builder = KijiDataRequest.builder();
    builder.newColumnsDef().withMaxVersions(5).withFilter(columnFilter).addFamily("jobs");
    final KijiDataRequest dataRequest = builder.build();
    EntityId meId = mTable.getEntityId(Bytes.toBytes("me"));
    KijiRowData myRowData = mReader.get(meId, dataRequest);
    final NavigableMap<String, NavigableMap<Long, CharSequence>> resultMap
        = myRowData.<CharSequence>getValues("jobs");
    assertEquals("The number of returned values is incorrect: ", 1, resultMap.get("b").size());
View Full Code Here

      final KijiTableLayout layout,
      final HBaseColumnNameTranslator columnTranslator,
      final CellDecoderProvider decoderProvider
  ) throws IOException {
    final Collection<Column> columnRequests = dataRequest.getColumns();
    final KijiDataRequestBuilder unpagedRequestBuilder = KijiDataRequest.builder();
    final KijiDataRequestBuilder pagedRequestBuilder = KijiDataRequest.builder();
    unpagedRequestBuilder.withTimeRange(
        dataRequest.getMinTimestamp(),
        dataRequest.getMaxTimestamp());
    pagedRequestBuilder.withTimeRange(dataRequest.getMinTimestamp(), dataRequest.getMaxTimestamp());

    for (Column columnRequest : columnRequests) {
      if (columnRequest.isPagingEnabled()) {
        pagedRequestBuilder.newColumnsDef(columnRequest);
      } else {
        unpagedRequestBuilder.newColumnsDef(columnRequest);
      }
    }

    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);
    }
View Full Code Here

TOP

Related Classes of org.kiji.schema.KijiDataRequestBuilder$ColumnsDef

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.