/** Returns true if the operator is satisfied (i.e. "otherValue operator value == true"), false otherwise. */ protected boolean compareWithOperator(Operator operator, AbstractType<?> type, ByteBuffer value, ByteBuffer otherValue) throws InvalidRequestException { if (value == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid 'unset' value in condition"); if (value == null) { switch (operator) { case EQ: return otherValue == null; case NEQ: return otherValue != null; default: throw new InvalidRequestException(String.format("Invalid comparison with null for operator \"%s\"", operator)); } } else if (otherValue == null) { // the condition value is not null, so only NEQ can return true return operator == Operator.NEQ; } return operator.isSatisfiedBy(type, otherValue, value); } }
/** Returns true if the operator is satisfied (i.e. "otherValue operator value == true"), false otherwise. */ protected boolean compareWithOperator(Operator operator, AbstractType<?> type, ByteBuffer value, ByteBuffer otherValue) throws InvalidRequestException { if (value == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid 'unset' value in condition"); if (value == null) { switch (operator) { case EQ: return otherValue == null; case NEQ: return otherValue != null; default: throw new InvalidRequestException(String.format("Invalid comparison with null for operator \"%s\"", operator)); } } else if (otherValue == null) { // the condition value is not null, so only NEQ can return true return operator == Operator.NEQ; } return operator.isSatisfiedBy(type, otherValue, value); } }
/** Returns true if the operator is satisfied (i.e. "otherValue operator value == true"), false otherwise. */ protected boolean compareWithOperator(Operator operator, AbstractType<?> type, ByteBuffer value, ByteBuffer otherValue) throws InvalidRequestException { if (value == ByteBufferUtil.UNSET_BYTE_BUFFER) throw new InvalidRequestException("Invalid 'unset' value in condition"); if (value == null) { switch (operator) { case EQ: return otherValue == null; case NEQ: return otherValue != null; default: throw new InvalidRequestException(String.format("Invalid comparison with null for operator \"%s\"", operator)); } } else if (otherValue == null) { // the condition value is not null, so only NEQ can return true return operator == Operator.NEQ; } return operator.isSatisfiedBy(type, otherValue, value); } }
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert value != null; // On thrift queries, even if the column expression is a "static" one, we'll have convert it as a "dynamic" // one in ThriftResultsMerger, so we always expect it to be a dynamic one. Further, we expect this is only // called when the row clustering does match the column (see ThriftFilter above). assert row.clustering().equals(makeCompactClustering(metadata, column.name.bytes)); Cell cell = row.getCell(metadata.compactValueColumn()); return cell != null && operator.isSatisfiedBy(column.type, cell.value(), value); }
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert value != null; // On thrift queries, even if the column expression is a "static" one, we'll have convert it as a "dynamic" // one in ThriftResultsMerger, so we always expect it to be a dynamic one. Further, we expect this is only // called when the row clustering does match the column (see ThriftFilter above). assert row.clustering().equals(makeCompactClustering(metadata, column.name.bytes)); Cell cell = row.getCell(metadata.compactValueColumn()); return cell != null && operator.isSatisfiedBy(column.type, cell.value(), value); }
public boolean isSatisfiedBy(CFMetaData metadata, DecoratedKey partitionKey, Row row) { assert value != null; // On thrift queries, even if the column expression is a "static" one, we'll have convert it as a "dynamic" // one in ThriftResultsMerger, so we always expect it to be a dynamic one. Further, we expect this is only // called when the row clustering does match the column (see ThriftFilter above). assert row.clustering().equals(makeCompactClustering(metadata, column.name.bytes)); Cell cell = row.getCell(metadata.compactValueColumn()); return cell != null && operator.isSatisfiedBy(column.type, cell.value(), value); }
/** * Returns true if all of the expressions within this filter that apply to the clustering key are satisfied by * the given Clustering, false otherwise. */ public boolean clusteringKeyRestrictionsAreSatisfiedBy(Clustering clustering) { for (Expression e : expressions) { if (!e.column.isClusteringColumn()) continue; if (!e.operator().isSatisfiedBy(e.column.type, clustering.get(e.column.position()), e.value)) { return false; } } return true; }
/** * Returns true if all of the expressions within this filter that apply to the clustering key are satisfied by * the given Clustering, false otherwise. */ public boolean clusteringKeyRestrictionsAreSatisfiedBy(Clustering clustering) { for (Expression e : expressions) { if (!e.column.isClusteringColumn()) continue; if (!e.operator().isSatisfiedBy(e.column.type, clustering.get(e.column.position()), e.value)) { return false; } } return true; }
/** * Returns true if all of the expressions within this filter that apply to the clustering key are satisfied by * the given Clustering, false otherwise. */ public boolean clusteringKeyRestrictionsAreSatisfiedBy(Clustering clustering) { for (Expression e : expressions) { if (!e.column.isClusteringColumn()) continue; if (!e.operator().isSatisfiedBy(e.column.type, clustering.get(e.column.position()), e.value)) { return false; } } return true; }
/** * Returns true if all of the expressions within this filter that apply to the partition key are satisfied by * the given key, false otherwise. */ public boolean partitionKeyRestrictionsAreSatisfiedBy(DecoratedKey key, AbstractType<?> keyValidator) { for (Expression e : expressions) { if (!e.column.isPartitionKey()) continue; ByteBuffer value = keyValidator instanceof CompositeType ? ((CompositeType) keyValidator).split(key.getKey())[e.column.position()] : key.getKey(); if (!e.operator().isSatisfiedBy(e.column.type, value, e.value)) return false; } return true; }
/** * Returns true if all of the expressions within this filter that apply to the partition key are satisfied by * the given key, false otherwise. */ public boolean partitionKeyRestrictionsAreSatisfiedBy(DecoratedKey key, AbstractType<?> keyValidator) { for (Expression e : expressions) { if (!e.column.isPartitionKey()) continue; ByteBuffer value = keyValidator instanceof CompositeType ? ((CompositeType) keyValidator).split(key.getKey())[e.column.position()] : key.getKey(); if (!e.operator().isSatisfiedBy(e.column.type, value, e.value)) return false; } return true; }
/** * Returns true if all of the expressions within this filter that apply to the partition key are satisfied by * the given key, false otherwise. */ public boolean partitionKeyRestrictionsAreSatisfiedBy(DecoratedKey key, AbstractType<?> keyValidator) { for (Expression e : expressions) { if (!e.column.isPartitionKey()) continue; ByteBuffer value = keyValidator instanceof CompositeType ? ((CompositeType) keyValidator).split(key.getKey())[e.column.position()] : key.getKey(); if (!e.operator().isSatisfiedBy(e.column.type, value, e.value)) return false; } return true; }
return operator.isSatisfiedBy(LongType.instance, counterValue, value); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value); ByteBuffer foundValue = getValue(metadata, partitionKey, row); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value);
return operator.isSatisfiedBy(LongType.instance, counterValue, value); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value); ByteBuffer foundValue = getValue(metadata, partitionKey, row); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value);
return operator.isSatisfiedBy(LongType.instance, counterValue, value); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value); ByteBuffer foundValue = getValue(metadata, partitionKey, row); return foundValue != null && operator.isSatisfiedBy(column.type, foundValue, value);