Package org.kiji.schema

Examples of org.kiji.schema.KijiDataRequest


  ) {
    mResult = result;
    mCells = mResult.iterator();
    mLayout = layout;

    final KijiDataRequest dataRequest = mResult.getDataRequest();
    final Collection<Column> columnRequests = dataRequest.getColumns();
    Preconditions.checkArgument(columnRequests.size() == 1,
        "Can not create KijiResultPager with multiple columns. Data request: %s.", dataRequest);
    mColumnRequest = columnRequests.iterator().next();
  }
View Full Code Here


      // Get a TableReader for our table.
      KijiTableReader tableReader = table.openTableReader();
      // Surround with a try/finally so the tablereader gets closed.
      try {
        // Build a DataRequest for the row we want.
        KijiDataRequest dataRequest = KijiDataRequest.create("info", "name");
        KijiRowData result = tableReader.get(entityId, dataRequest);
        String name = result.getMostRecentValue("info", "name").toString();
        System.out.println("Read username " + name + " from table.");
      } finally {
        tableReader.close();
View Full Code Here

  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

  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

  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

                  .build()))
          .build();

      final KijiTableReader reader = table.getReaderFactory().openTableReader(overrides);
      try {
        final KijiDataRequest dataRequest = KijiDataRequest.builder()
            .addColumns(ColumnsDef.create().withFilter(new CellByteSizeAsValueFilter()).add(column))
            .build();
        final KijiRowData row = reader.get(eid, dataRequest);
        final GenericData.Fixed fixed32 = row.getMostRecentValue("family", "column");
        final int cellSize = Bytes.toInt(fixed32.bytes());
View Full Code Here

    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", 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", "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

    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

TOP

Related Classes of org.kiji.schema.KijiDataRequest

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.