Examples of SliceRange


Examples of org.apache.cassandra.thrift.SliceRange

    }

    // get value
    ColumnParent clp = new ColumnParent("Standard1");
    SlicePredicate slicePredicate = new SlicePredicate();
    SliceRange sr = new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new byte[0]), false, 150);
    slicePredicate.setSlice_range(sr);
    Map<ByteBuffer,Integer> counts = keyspace.multigetCount(keys, clp, slicePredicate);
    assertEquals(5,counts.size());
    assertEquals(new Integer(25),counts.entrySet().iterator().next().getValue());

    slicePredicate.setSlice_range(new SliceRange(StringSerializer.get().toByteBuffer(""),
        StringSerializer.get().toByteBuffer(""), false, 5));
    counts = keyspace.multigetCount(keys, clp, slicePredicate);

    assertEquals(5,counts.size());
    assertEquals(new Integer(5),counts.entrySet().iterator().next().getValue());
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

    ConcreteSliceQueury<String, String, String, Rows<String, String, String>> q =
      new ConcreteSliceQueury<String, String, String, Rows<String, String,String>>(ko, se, se, se);
    q.setRange("1", "100", false, 10);
    SlicePredicate p = q.getPredicate();
    assertNull(p.getColumn_names());
    SliceRange range = p.getSlice_range();
    assertNotNull(range);
    assertArrayEquals(bytes("1"), range.getStart());
    assertArrayEquals(bytes("100"), range.getFinish());
    assertEquals(10, range.getCount());
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

  @Override
  public SuperColumn getSuperColumn(final ByteBuffer key, final ColumnPath columnPath,
      final boolean reversed, final int size) throws HectorException {
    //valideSuperColumnPath(columnPath);
    final SliceRange sliceRange = new SliceRange(ByteBuffer.wrap(new byte[0]),
        ByteBuffer.wrap(new byte[0]), reversed, size);
    Operation<SuperColumn> op = new Operation<SuperColumn>(OperationType.READ, failoverPolicy,
        keyspaceName, credentials) {

      @Override
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

    // only can get supercolumn by multigetSuperSlice
    ColumnParent clp = new ColumnParent(columnPath.getColumn_family());
    clp.setSuper_column(columnPath.getSuper_column());

    SliceRange sr = new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new byte[0]), reversed, size);
    SlicePredicate sp = new SlicePredicate();
    sp.setSlice_range(sr);

    Map<ByteBuffer, List<SuperColumn>> sclist = multigetSuperSlice(keys, clp, sp);
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

      }
      pred.setColumn_names(toThriftColumnNames(columnNames));
      break;
    case Range:
      Assert.isTrue(countSet, "Count was not set, neither were column-names set, can't execute");
      SliceRange range = new SliceRange(findBytes(start), findBytes(finish), reversed, count);
      pred.setSlice_range(range);
      break;
    case Unknown:
    default:
      throw new HectorException(
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

            final SortedSet<ByteBuffer> columnNameSet = new TreeSet<ByteBuffer>(comparator);
            columnNameSet.addAll(predicate.column_names);
            return new NamesQueryFilter(columnNameSet);
        }

        SliceRange range = predicate.slice_range;
        return new SliceQueryFilter(range.start, range.finish, range.reversed, range.count);
    }
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

        {
            throw new IOException("Expected 'cassandra://<keyspace>/<columnfamily>': " + e.getMessage());
        }

        // and configure
        SliceRange range = new SliceRange(BOUND, BOUND, false, LIMIT);
        SlicePredicate predicate = new SlicePredicate().setSlice_range(range);
        conf = job.getConfiguration();
        ConfigHelper.setInputSlicePredicate(conf, predicate);
        ConfigHelper.setInputColumnFamily(conf, ksname, cfname);
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

        ByteBuffer startCol = ByteBuffer.wrap("Start".getBytes());
        ByteBuffer stopCol = ByteBuffer.wrap("Stop".getBytes());
        ByteBuffer emptyCol = ByteBuffer.wrap("".getBytes());
        SlicePredicate namesPred = new SlicePredicate();
        namesPred.column_names = Statics.NamedCols;
        SliceRange emptySliceRange = new SliceRange(emptyCol, emptyCol, false, 100);
        SliceRange nonEmptySliceRange = new SliceRange(startCol, stopCol, true, 100);
        SlicePredicate emptyRangePred = new SlicePredicate();
        emptyRangePred.slice_range = emptySliceRange;
        SlicePredicate nonEmptyRangePred = new SlicePredicate();
        nonEmptyRangePred.slice_range = nonEmptySliceRange;
        IPartitioner part = StorageService.getPartitioner();
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

                new Column(getBytes(5), ByteBufferUtil.bytes("val5"), 1),
                new Column(getBytes(6), ByteBufferUtil.bytes("val6"), 1));
       
        // verify insert.
        final SlicePredicate sp = new SlicePredicate();
        sp.setSlice_range(new SliceRange());
        sp.getSlice_range().setCount(100);
        sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY);
        sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY);
       
        assertRowAndColCount(1, 6, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator())));
View Full Code Here

Examples of org.apache.cassandra.thrift.SliceRange

        Table table = Table.open(tableName);
        ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
        DecoratedKey key = Util.dk("f-flush-resurrection");
       
        SlicePredicate sp = new SlicePredicate();
        sp.setSlice_range(new SliceRange());
        sp.getSlice_range().setCount(100);
        sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY);
        sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY);
       
        // insert
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.