Package org.kiji.schema

Examples of org.kiji.schema.KijiDataRequest


   *
   * @param column The column for which to validate a request exists.
   * @return Whether the data request contains a request for the column.
   */
  private boolean containsColumnRequest(final KijiColumnName column) {
    final KijiDataRequest dataRequest = mResult.getDataRequest();
    final Column exactRequest = dataRequest.getColumn(column);
    if (exactRequest != null) {
      Preconditions.checkArgument(!exactRequest.isPagingEnabled(),
          "Paging is enabled for column %s in data request %s.", exactRequest, dataRequest);
      return true;
    } else if (column.isFullyQualified()) {
      // The column is fully qualified, but a request doesn't exist for the qualified column.
      // Check if the family is requested, and validate it.
      final Column familyRequest =
          dataRequest.getColumn(KijiColumnName.create(column.getFamily(), null));
      if (familyRequest == null) {
        return false;
      }
      Preconditions.checkArgument(
          !familyRequest.isPagingEnabled(),
          "Paging is enabled for column %s in data request %s.", familyRequest, dataRequest);
      return true;
    } else {
      boolean requestContainsColumns = false;
      for (final Column columnRequest : dataRequest.getColumns()) {
        if (columnRequest.getColumnName().getFamily().equals(column.getFamily())) {
          Preconditions.checkArgument(
              !columnRequest.isPagingEnabled(),
              "Paging is enabled for column %s in data request %s.", columnRequest, dataRequest);
          requestContainsColumns = true;
View Full Code Here


  @Test
  public void testGetFullyQualifiedColumn() throws Exception {
    for (KijiColumnName column : ImmutableList.of(PRIMITIVE_STRING, STRING_MAP_1)) {
      for (int pageSize : ImmutableList.of(0, 1, 2, 10)) {
        { // Single version | no timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef.create()
                      .withPageSize(pageSize)
                      .add(column.getFamily(), column.getQualifier()))
              .build();

          testViewGet(request, Iterables.limit(ROW_DATA.get(column).entrySet(), 1));
        }

        { // Single version | timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef.create()
                      .withPageSize(pageSize)
                      .add(column.getFamily(), column.getQualifier()))
              .withTimeRange(4, 6)
              .build();

          testViewGet(
              request,
              Iterables.limit(ROW_DATA.get(column).subMap(6L, false, 4L, true).entrySet(), 1));
        }

        { // Multiple versions | no timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef.create()
                      .withPageSize(pageSize)
                      .withMaxVersions(100)
                      .add(column.getFamily(), column.getQualifier()))
              .build();

          testViewGet(
              request,
              ROW_DATA.get(column).entrySet());
        }

        { // Multiple versions | timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef.create()
                      .withPageSize(pageSize)
                      .withMaxVersions(100)
View Full Code Here

    final KijiColumnName column2 = STRING_MAP_1;

    for (int pageSize : ImmutableList.of(0, 1, 2, 10)) {

      { // Single version | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .add(column1.getFamily(), column1.getQualifier())
                    .add(column2.getFamily(), column2.getQualifier()))
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            Iterables.limit(ROW_DATA.get(column1).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).entrySet(), 1);

        testViewGet(request, Iterables.concat(column1Entries, column2Entries));
      }

      { // Single version | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .add(column1.getFamily(), column1.getQualifier())
                    .add(column2.getFamily(), column2.getQualifier()))
            .withTimeRange(4, 6)
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            Iterables.limit(ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet(), 1);

        testViewGet(request, Iterables.concat(column1Entries, column2Entries));
      }

      { // Multiple versions | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withMaxVersions(100)
                    .add(column1.getFamily(), column1.getQualifier())
                    .add(column2.getFamily(), column2.getQualifier()))
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries = ROW_DATA.get(column1).entrySet();
        final Iterable<? extends Entry<Long, ?>> column2Entries = ROW_DATA.get(column2).entrySet();

        testViewGet(request, Iterables.concat(column1Entries, column2Entries));
      }

      { // Multiple versions | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withMaxVersions(100)
                    .add(column1.getFamily(), column1.getQualifier())
                    .add(column2.getFamily(), column2.getQualifier()))
            .withTimeRange(4, 6)
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet();
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet();

        testViewGet(request, Iterables.concat(column1Entries, column2Entries));
      }

      { // Mixed versions | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withMaxVersions(100)
                    .add(column1.getFamily(), column1.getQualifier()))
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withMaxVersions(1)
                    .add(column2.getFamily(), column2.getQualifier()))
            .withTimeRange(4, 6)
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet();
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet(), 1);

        testViewGet(request, Iterables.concat(column1Entries, column2Entries));
      }

      { // Mixed versions | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withMaxVersions(1)
View Full Code Here

        final KijiColumnName familyColumn = KijiColumnName.create(family.getKey(), null);
        final KijiColumnName column1 = family.getValue().get(0);
        final KijiColumnName column2 = family.getValue().get(1);

        { // Single version | no timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(ColumnsDef.create().withPageSize(pageSize).add(familyColumn))
              .build();

          final Iterable<? extends Entry<Long, ?>> column1Entries =
              Iterables.limit(ROW_DATA.get(column1).entrySet(), 1);
          final Iterable<? extends Entry<Long, ?>> column2Entries =
              Iterables.limit(ROW_DATA.get(column2).entrySet(), 1);

          testViewGet(request, Iterables.concat(column1Entries, column2Entries));
        }

        { // Single version | timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(ColumnsDef.create().withPageSize(pageSize).add(familyColumn))
              .withTimeRange(4, 6)
              .build();

          final Iterable<? extends Entry<Long, ?>> column1Entries =
              Iterables.limit(ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet(), 1);
          final Iterable<? extends Entry<Long, ?>> column2Entries =
              Iterables.limit(ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet(), 1);

          testViewGet(request, Iterables.concat(column1Entries, column2Entries));
        }

        { // Multiple versions | no timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef
                      .create()
                      .withPageSize(pageSize)
                      .withMaxVersions(100)
                      .add(familyColumn))
              .build();

          final Iterable<? extends Entry<Long, ?>> column1Entries =
              ROW_DATA.get(column1).entrySet();
          final Iterable<? extends Entry<Long, ?>> column2Entries =
              ROW_DATA.get(column2).entrySet();

          testViewGet(request, Iterables.concat(column1Entries, column2Entries));
        }

        { // Multiple versions | timerange
          final KijiDataRequest request = KijiDataRequest
              .builder()
              .addColumns(
                  ColumnsDef
                      .create()
                      .withPageSize(pageSize)
View Full Code Here

    final KijiColumnName column4 = STRING_MAP_2;

    for (int pageSize : ImmutableList.of(0, 1, 2, 10)) {

      { // Single version | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(ColumnsDef.create().add(familyColumn1))
            .addColumns(ColumnsDef.create().add(familyColumn2))
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            Iterables.limit(ROW_DATA.get(column1).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column3Entries =
            Iterables.limit(ROW_DATA.get(column3).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column4Entries =
            Iterables.limit(ROW_DATA.get(column4).entrySet(), 1);

        testViewGet(
            request,
            Iterables.concat(column1Entries, column2Entries, column3Entries, column4Entries));
      }

      { // Single version | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(ColumnsDef.create().withPageSize(pageSize).add(familyColumn1))
            .addColumns(ColumnsDef.create().withPageSize(pageSize).add(familyColumn2))
            .withTimeRange(4, 6)
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            Iterables.limit(ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column3Entries =
            Iterables.limit(ROW_DATA.get(column3).subMap(6L, false, 4L, true).entrySet(), 1);
        final Iterable<? extends Entry<Long, ?>> column4Entries =
            Iterables.limit(ROW_DATA.get(column4).subMap(6L, false, 4L, true).entrySet(), 1);

        testViewGet(
            request,
            Iterables.concat(column1Entries, column2Entries, column3Entries, column4Entries));
      }

      { // Multiple versions | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn1))
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn2))
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries = ROW_DATA.get(column1).entrySet();
        final Iterable<? extends Entry<Long, ?>> column2Entries = ROW_DATA.get(column2).entrySet();
        final Iterable<? extends Entry<Long, ?>> column3Entries = ROW_DATA.get(column3).entrySet();
        final Iterable<? extends Entry<Long, ?>> column4Entries = ROW_DATA.get(column4).entrySet();

        testViewGet(
            request,
            Iterables.concat(column1Entries, column2Entries, column3Entries, column4Entries));
      }

      { // Multiple versions | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn1))
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn2))
            .withTimeRange(4, 6)
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            ROW_DATA.get(column1).subMap(6L, false, 4L, true).entrySet();
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            ROW_DATA.get(column2).subMap(6L, false, 4L, true).entrySet();
        final Iterable<? extends Entry<Long, ?>> column3Entries =
            ROW_DATA.get(column3).subMap(6L, false, 4L, true).entrySet();
        final Iterable<? extends Entry<Long, ?>> column4Entries =
            ROW_DATA.get(column4).subMap(6L, false, 4L, true).entrySet();

        testViewGet(
            request,
            Iterables.concat(column1Entries, column2Entries, column3Entries, column4Entries));
      }

      { // Mixed versions | no timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(2).add(familyColumn1))
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn2))
            .build();

        final Iterable<? extends Entry<Long, ?>> column1Entries =
            Iterables.limit(ROW_DATA.get(column1).entrySet(), 2);
        final Iterable<? extends Entry<Long, ?>> column2Entries =
            Iterables.limit(ROW_DATA.get(column2).entrySet(), 2);
        final Iterable<? extends Entry<Long, ?>> column3Entries = ROW_DATA.get(column3).entrySet();
        final Iterable<? extends Entry<Long, ?>> column4Entries = ROW_DATA.get(column4).entrySet();

        testViewGet(
            request,
            Iterables.concat(column1Entries, column2Entries, column3Entries, column4Entries));
      }

      { // Multiple versions | timerange
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn1))
            .addColumns(
                ColumnsDef.create().withPageSize(pageSize).withMaxVersions(1).add(familyColumn2))
View Full Code Here

    final KijiColumnName column3 = STRING_MAP_1;
    final KijiColumnName column4 = STRING_MAP_2;

    for (int pageSize : ImmutableList.of(0)) {

      final KijiDataRequest request = KijiDataRequest
          .builder()
          .addColumns(
              ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(familyColumn1))
          .addColumns(
              ColumnsDef.create().withPageSize(pageSize).withMaxVersions(100).add(column3))
View Full Code Here

    final KijiColumnName column1 = PRIMITIVE_STRING;
    final KijiColumnName column2 = STRING_MAP_1;

    for (int pageSize : ImmutableList.of(0, 1, 2, 10)) {
      { // single column | CRF
        final KijiDataRequest request = KijiDataRequest
            .builder()
            .addColumns(
                ColumnsDef.create()
                    .withPageSize(pageSize)
                    .withFilter(
View Full Code Here

  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

  private void singleValue(
      final HBaseKijiTable table,
      final HBaseKijiTableReader reader
  ) throws IOException {
    {
      final KijiDataRequest singletonRequest = KijiDataRequest.create("map", "10");
      final long rowDataStartTime = System.nanoTime();
      final KijiRowData testRowData = reader.get(table.getEntityId("foo"), singletonRequest);
      testRowData.containsCell("family", "qualifier", 1);
      final Integer value = testRowData.getMostRecentValue("map", "10");
      LOG.info("row data single value time = {} nanoseconds",
View Full Code Here

  private void paged(
      final HBaseKijiTableReader reader,
      final EntityId eid
  ) throws IOException {
    final KijiDataRequest pagedRequest = KijiDataRequest.builder().addColumns(
        ColumnsDef.create().withPageSize(10).withMaxVersions(10000).add("map", null)).build();
    {
      final KijiRowData warmupRowData = reader.get(eid, pagedRequest);
      for (KijiCell<Integer> cell : warmupRowData.<Integer>asIterable("map")) {
        cell.getData();
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.