Examples of IndexExpression


Examples of org.apache.cassandra.thrift.IndexExpression

            if (restriction.isEquality())
            {
                for (Term t : restriction.eqValues)
                {
                    ByteBuffer value = t.getByteBuffer(name.type, variables);
                    expressions.add(new IndexExpression(name.name.key, IndexOperator.EQ, value));
                }
            }
            else
            {
                for (Bound b : Bound.values())
                {
                    if (restriction.bound(b) != null)
                    {
                        ByteBuffer value = restriction.bound(b).getByteBuffer(name.type, variables);
                        expressions.add(new IndexExpression(name.name.key, restriction.getIndexOperator(b), value));
                    }
                }
            }
        }
        return expressions;
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        // make sure all sstables including 2ary indexes load from disk
        for (ColumnFamilyStore cfs : indexedCFS.concatWithIndexes())
            clearAndLoad(cfs);

        // query using index to see if sstable for secondary index opens
        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, ByteBufferUtil.bytes(1L));
        List<IndexExpression> clause = Arrays.asList(expr);
        IPartitioner p = StorageService.getPartitioner();
        Range<RowPosition> range = Util.range("", "");
        List<Row> rows = indexedCFS.search(clause, range, 100, new IdentityQueryFilter());
        assert rows.size() == 1;
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

    super(k, keySerializer, nameSerializer, valueSerializer);
    indexClause = new IndexClause();
  }

  public IndexedSlicesQuery<K,N,V> addEqualsExpression(N columnName, V columnValue) {
    indexClause.addToExpressions(new IndexExpression(columnNameSerializer.toByteBuffer(columnName),
        IndexOperator.EQ,
        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }

  public IndexedSlicesQuery<K,N,V> addLteExpression(N columnName, V columnValue) {
    indexClause.addToExpressions(new IndexExpression(columnNameSerializer.toByteBuffer(columnName),
        IndexOperator.LTE,
        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }

  public IndexedSlicesQuery<K,N,V> addGteExpression(N columnName, V columnValue) {
    indexClause.addToExpressions(new IndexExpression(columnNameSerializer.toByteBuffer(columnName),
        IndexOperator.GTE,
        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }

  public IndexedSlicesQuery<K,N,V> addLtExpression(N columnName, V columnValue) {
    indexClause.addToExpressions(new IndexExpression(columnNameSerializer.toByteBuffer(columnName),
        IndexOperator.LT,
        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }

  public IndexedSlicesQuery<K,N,V> addGtExpression(N columnName, V columnValue) {
    indexClause.addToExpressions(new IndexExpression(columnNameSerializer.toByteBuffer(columnName),
        IndexOperator.GT,
        valueSerializer.toByteBuffer(columnValue)));
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

    public List<Row> scan(IndexClause clause, AbstractBounds range, IFilter dataFilter)
    {
        // Start with the most-restrictive indexed clause, then apply remaining clauses
        // to each row matching that clause.
        // TODO: allow merge join instead of just one index + loop
        IndexExpression primary = highestSelectivityPredicate(clause);
        ColumnFamilyStore indexCFS = getIndexedColumnFamilyStore(primary.column_name);
        if (logger.isDebugEnabled())
            logger.debug("Primary scan clause is " + getComparator().getString(primary.column_name));
        assert indexCFS != null;
        DecoratedKey indexKey = indexCFS.partitioner.decorateKey(primary.value);
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

        return rows;
    }

    private IndexExpression highestSelectivityPredicate(IndexClause clause)
    {
        IndexExpression best = null;
        int bestMeanCount = Integer.MAX_VALUE;
        for (IndexExpression expression : clause.expressions)
        {
            ColumnFamilyStore cfs = getIndexedColumnFamilyStore(expression.column_name);
            if (cfs == null || !expression.op.equals(IndexOperator.EQ))
View Full Code Here

Examples of org.apache.cassandra.thrift.IndexExpression

    public List<Row> scan(IndexClause clause, AbstractBounds range, IFilter dataFilter)
    {
        // Start with the most-restrictive indexed clause, then apply remaining clauses
        // to each row matching that clause.
        // TODO: allow merge join instead of just one index + loop
        IndexExpression primary = highestSelectivityPredicate(clause);
        ColumnFamilyStore indexCFS = getIndexedColumnFamilyStore(primary.column_name);
        if (logger.isDebugEnabled())
            logger.debug("Primary scan clause is " + getComparator().getString(primary.column_name));
        assert indexCFS != null;
        DecoratedKey indexKey = indexCFS.partitioner.decorateKey(primary.value);
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.