本文整理汇总了Java中org.apache.cassandra.db.filter.SliceQueryFilter类的典型用法代码示例。如果您正苦于以下问题:Java SliceQueryFilter类的具体用法?Java SliceQueryFilter怎么用?Java SliceQueryFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SliceQueryFilter类属于org.apache.cassandra.db.filter包,在下文中一共展示了SliceQueryFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: queryNextPage
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestExecutionException
{
SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
Composite start = lastReturnedName == null ? sf.start() : lastReturnedName;
PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
command.columnFamily,
command.timestamp,
keyRange,
sf,
start,
sf.finish(),
command.rowFilter,
pageSize,
command.countCQL3Rows);
return localQuery
? pageCmd.executeLocally()
: StorageProxy.getRangeSlice(pageCmd, consistencyLevel);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:RangeSliceQueryPager.java
示例2: countPaged
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
/**
* Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
*/
public static int countPaged(String keyspace,
String columnFamily,
ByteBuffer key,
SliceQueryFilter filter,
ConsistencyLevel consistencyLevel,
ClientState cState,
final int pageSize,
long now) throws RequestValidationException, RequestExecutionException
{
SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false);
ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now);
while (!pager.isExhausted())
{
List<Row> next = pager.fetchPage(pageSize);
if (!next.isEmpty())
counter.countAll(next.get(0).cf);
}
return counter.live();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:QueryPagers.java
示例3: queryNextPage
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestValidationException, RequestExecutionException
{
// For some queries, such as a DISTINCT query on static columns, the limit for slice queries will be lower
// than the page size (in the static example, it will be 1). We use the min here to ensure we don't fetch
// more rows than we're supposed to. See CASSANDRA-8108 for more details.
SliceQueryFilter filter = command.filter.withUpdatedCount(Math.min(command.filter.count, pageSize));
if (lastReturned != null)
filter = filter.withUpdatedStart(lastReturned, cfm.comparator);
logger.debug("Querying next page of slice query; new filter: {}", filter);
ReadCommand pageCmd = command.withUpdatedFilter(filter);
return localQuery
? Collections.singletonList(pageCmd.getRow(Keyspace.open(command.ksName)))
: StorageProxy.read(Collections.singletonList(pageCmd), consistencyLevel, cstate);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:SliceQueryPager.java
示例4: maybeGenerateRetryCommand
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
@Override
public ReadCommand maybeGenerateRetryCommand(RowDataResolver resolver, Row row)
{
int maxLiveColumns = resolver.getMaxLiveCount();
int count = filter.count;
// We generate a retry if at least one node reply with count live columns but after merge we have less
// than the total number of column we are interested in (which may be < count on a retry).
// So in particular, if no host returned count live columns, we know it's not a short read.
if (maxLiveColumns < count)
return null;
int liveCountInRow = row == null || row.cf == null ? 0 : filter.getLiveCount(row.cf, timestamp);
if (liveCountInRow < getOriginalRequestedCount())
{
// We asked t (= count) live columns and got l (=liveCountInRow) ones.
// From that, we can estimate that on this row, for x requested
// columns, only l/t end up live after reconciliation. So for next
// round we want to ask x column so that x * (l/t) == t, i.e. x = t^2/l.
int retryCount = liveCountInRow == 0 ? count + 1 : ((count * count) / liveCountInRow) + 1;
SliceQueryFilter newFilter = filter.withUpdatedCount(retryCount);
return new RetriedSliceFromReadCommand(ksName, key, cfName, timestamp, newFilter, getOriginalRequestedCount());
}
return null;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:SliceFromReadCommand.java
示例5: makePrefix
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
private Composite makePrefix(CompositesIndex index, ByteBuffer key, ExtendedFilter filter, boolean isStart)
{
if (key.remaining() == 0)
return Composites.EMPTY;
Composite prefix;
IDiskAtomFilter columnFilter = filter.columnFilter(key);
if (columnFilter instanceof SliceQueryFilter)
{
SliceQueryFilter sqf = (SliceQueryFilter)columnFilter;
Composite columnName = isStart ? sqf.start() : sqf.finish();
prefix = columnName.isEmpty() ? index.getIndexComparator().make(key) : index.makeIndexColumnPrefix(key, columnName);
}
else
{
prefix = index.getIndexComparator().make(key);
}
return isStart ? prefix.start() : prefix.end();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:CompositesSearcher.java
示例6: queryNextPage
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestExecutionException
{
SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
ByteBuffer start = lastReturnedName == null ? sf.start() : lastReturnedName;
PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
command.columnFamily,
command.timestamp,
keyRange,
sf,
start,
sf.finish(),
command.rowFilter,
pageSize);
return localQuery
? pageCmd.executeLocally()
: StorageProxy.getRangeSlice(pageCmd, consistencyLevel);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:RangeSliceQueryPager.java
示例7: countPaged
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
/**
* Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
*/
public static int countPaged(String keyspace,
String columnFamily,
ByteBuffer key,
SliceQueryFilter filter,
ConsistencyLevel consistencyLevel,
final int pageSize,
long now) throws RequestValidationException, RequestExecutionException
{
SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);
ColumnCounter counter = filter.columnCounter(Schema.instance.getComparator(keyspace, columnFamily), now);
while (!pager.isExhausted())
{
List<Row> next = pager.fetchPage(pageSize);
if (!next.isEmpty())
counter.countAll(next.get(0).cf);
}
return counter.live();
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:QueryPagers.java
示例8: intersects
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
@Override
public boolean intersects(List<ByteBuffer> minColumnNames, List<ByteBuffer> maxColumnNames, SliceQueryFilter filter)
{
assert minColumnNames.size() == maxColumnNames.size();
for (ColumnSlice slice : filter.slices)
{
ByteBuffer[] start = split(filter.isReversed() ? slice.finish : slice.start);
ByteBuffer[] finish = split(filter.isReversed() ? slice.start : slice.finish);
for (int i = 0; i < minColumnNames.size(); i++)
{
AbstractType<?> t = types.get(i);
ByteBuffer s = i < start.length ? start[i] : ByteBufferUtil.EMPTY_BYTE_BUFFER;
ByteBuffer f = i < finish.length ? finish[i] : ByteBufferUtil.EMPTY_BYTE_BUFFER;
if (!t.intersects(minColumnNames.get(i), maxColumnNames.get(i), s, f))
return false;
}
}
return true;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:20,代码来源:CompositeType.java
示例9: countPaged
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
/**
* Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
*/
public static int countPaged(String keyspace,
String columnFamily,
ByteBuffer key,
SliceQueryFilter filter,
ConsistencyLevel consistencyLevel,
final int pageSize,
long now) throws RequestValidationException, RequestExecutionException
{
SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter);
final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, false);
ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now);
while (!pager.isExhausted())
{
List<Row> next = pager.fetchPage(pageSize);
if (!next.isEmpty())
counter.countAll(next.get(0).cf);
}
return counter.live();
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:24,代码来源:QueryPagers.java
示例10: maybeGenerateRetryCommand
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
@Override
public ReadCommand maybeGenerateRetryCommand(RowDataResolver resolver, Row row)
{
int maxLiveColumns = resolver.getMaxLiveCount();
int count = filter.count;
// We generate a retry if at least one node reply with count live columns but after merge we have less
// than the total number of column we are interested in (which may be < count on a retry).
// So in particular, if no host returned count live columns, we know it's not a short read.
if (maxLiveColumns < count)
return null;
int liveCountInRow = row == null || row.cf == null ? 0 : filter.getLiveCount(row.cf);
if (liveCountInRow < getOriginalRequestedCount())
{
// We asked t (= count) live columns and got l (=liveCountInRow) ones.
// From that, we can estimate that on this row, for x requested
// columns, only l/t end up live after reconciliation. So for next
// round we want to ask x column so that x * (l/t) == t, i.e. x = t^2/l.
int retryCount = liveCountInRow == 0 ? count + 1 : ((count * count) / liveCountInRow) + 1;
SliceQueryFilter newFilter = filter.withUpdatedCount(retryCount);
return new RetriedSliceFromReadCommand(table, key, queryPath, newFilter, getOriginalRequestedCount());
}
return null;
}
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:27,代码来源:SliceFromReadCommand.java
示例11: queryNextPage
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestExecutionException
{
SliceQueryFilter sf = (SliceQueryFilter)columnFilter;
AbstractBounds<RowPosition> keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey);
Composite start = lastReturnedName == null ? sf.start() : lastReturnedName;
PagedRangeCommand pageCmd = new PagedRangeCommand(command.keyspace,
command.columnFamily,
command.timestamp,
keyRange,
sf,
start,
sf.finish(),
command.rowFilter,
pageSize);
return localQuery
? pageCmd.executeLocally()
: StorageProxy.getRangeSlice(pageCmd, consistencyLevel);
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:21,代码来源:RangeSliceQueryPager.java
示例12: makePrefix
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
private Composite makePrefix(CompositesIndex index, ByteBuffer key, ExtendedFilter filter, boolean isStart)
{
if (key.remaining() == 0)
return Composites.EMPTY;
Composite prefix;
IDiskAtomFilter columnFilter = filter.columnFilter(key);
if (columnFilter instanceof SliceQueryFilter)
{
SliceQueryFilter sqf = (SliceQueryFilter)columnFilter;
prefix = index.makeIndexColumnPrefix(key, isStart ? sqf.start() : sqf.finish());
}
else
{
prefix = index.getIndexComparator().make(key);
}
return isStart ? prefix.start() : prefix.end();
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:19,代码来源:CompositesSearcher.java
示例13: makeExtendedFilter
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
/**
* Allows generic range paging with the slice column filter.
* Typically, suppose we have rows A, B, C ... Z having each some columns in [1, 100].
* And suppose we want to page through the query that for all rows returns the columns
* within [25, 75]. For that, we need to be able to do a range slice starting at (row r, column c)
* and ending at (row Z, column 75), *but* that only return columns in [25, 75].
* That is what this method allows. The columnRange is the "window" of columns we are interested
* in each row, and columnStart (resp. columnEnd) is the start (resp. end) for the first
* (resp. last) requested row.
*/
public ExtendedFilter makeExtendedFilter(AbstractBounds<RowPosition> keyRange,
SliceQueryFilter columnRange,
Composite columnStart,
Composite columnStop,
List<IndexExpression> rowFilter,
int maxResults,
boolean countCQL3Rows,
long now)
{
DataRange dataRange = new DataRange.Paging(keyRange, columnRange, columnStart, columnStop, metadata.comparator);
return ExtendedFilter.create(this, dataRange, rowFilter, maxResults, countCQL3Rows, now);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:ColumnFamilyStore.java
示例14: AbstractCType
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected AbstractCType(boolean isByteOrderComparable)
{
reverseComparator = new Comparator<Composite>()
{
public int compare(Composite c1, Composite c2)
{
return AbstractCType.this.compare(c2, c1);
}
};
indexComparator = new Comparator<IndexInfo>()
{
public int compare(IndexInfo o1, IndexInfo o2)
{
return AbstractCType.this.compare(o1.lastName, o2.lastName);
}
};
indexReverseComparator = new Comparator<IndexInfo>()
{
public int compare(IndexInfo o1, IndexInfo o2)
{
return AbstractCType.this.compare(o1.firstName, o2.firstName);
}
};
serializer = new Serializer(this);
indexSerializer = new IndexInfo.Serializer(this);
sliceSerializer = new ColumnSlice.Serializer(this);
sliceQueryFilterSerializer = new SliceQueryFilter.Serializer(this);
deletionInfoSerializer = new DeletionInfo.Serializer(this);
rangeTombstoneSerializer = new RangeTombstone.Serializer(this);
rowIndexEntrySerializer = new RowIndexEntry.Serializer(this);
this.isByteOrderComparable = isByteOrderComparable;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:35,代码来源:AbstractCType.java
示例15: create
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
public static ReadCommand create(String ksName, ByteBuffer key, String cfName, long timestamp, IDiskAtomFilter filter)
{
if (filter instanceof SliceQueryFilter)
return new SliceFromReadCommand(ksName, key, cfName, timestamp, (SliceQueryFilter)filter);
else
return new SliceByNamesReadCommand(ksName, key, cfName, timestamp, (NamesQueryFilter)filter);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ReadCommand.java
示例16: deserialize
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
public ReadCommand deserialize(DataInput in, int version) throws IOException
{
boolean isDigest = in.readBoolean();
String keyspaceName = in.readUTF();
ByteBuffer key = ByteBufferUtil.readWithShortLength(in);
String cfName = in.readUTF();
long timestamp = in.readLong();
CFMetaData metadata = Schema.instance.getCFMetaData(keyspaceName, cfName);
SliceQueryFilter filter = metadata.comparator.sliceQueryFilterSerializer().deserialize(in, version);
return new SliceFromReadCommand(keyspaceName, key, cfName, timestamp, filter).setIsDigestQuery(isDigest);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:SliceFromReadCommand.java
示例17: getRangeSlice
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
public static List<Row> getRangeSlice(ColumnFamilyStore cfs, ByteBuffer superColumn)
{
IDiskAtomFilter filter = superColumn == null
? new IdentityQueryFilter()
: new SliceQueryFilter(SuperColumns.startOf(superColumn), SuperColumns.endOf(superColumn), false, Integer.MAX_VALUE);
Token min = StorageService.getPartitioner().getMinimumToken();
return cfs.getRangeSlice(new Bounds<Token>(min, min).toRowBounds(), null, filter, 10000);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:Util.java
示例18: findRowGetSlicesAndAssertColsFound
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
private void findRowGetSlicesAndAssertColsFound(ColumnFamilyStore cfs, SliceQueryFilter filter, String rowKey,
String... colNames)
{
List<Row> rows = cfs.getRangeSlice(new Bounds<RowPosition>(rp(rowKey), rp(rowKey)),
null,
filter,
Integer.MAX_VALUE,
System.currentTimeMillis(),
false,
false);
assertSame("unexpected number of rows ", 1, rows.size());
Row row = rows.get(0);
Collection<Cell> cols = !filter.isReversed() ? row.cf.getSortedColumns() : row.cf.getReverseSortedColumns();
// printRow(cfs, new String(row.key.key.array()), cols);
String[] returnedColsNames = Iterables.toArray(Iterables.transform(cols, new Function<Cell, String>()
{
public String apply(Cell arg0)
{
return Util.string(arg0.name().toByteBuffer());
}
}), String.class);
assertTrue(
"Columns did not match. Expected: " + Arrays.toString(colNames) + " but got:"
+ Arrays.toString(returnedColsNames), Arrays.equals(colNames, returnedColsNames));
int i = 0;
for (Cell col : cols)
{
assertEquals(colNames[i++], Util.string(col.name().toByteBuffer()));
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:32,代码来源:ColumnFamilyStoreTest.java
示例19: queryNextPage
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
protected List<Row> queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)
throws RequestValidationException, RequestExecutionException
{
SliceQueryFilter filter = command.filter.withUpdatedCount(pageSize);
if (lastReturned != null)
filter = filter.withUpdatedStart(lastReturned, cfm.comparator);
ReadCommand pageCmd = command.withUpdatedFilter(filter);
return localQuery
? Collections.singletonList(pageCmd.getRow(Keyspace.open(command.ksName)))
: StorageProxy.read(Collections.singletonList(pageCmd), consistencyLevel);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:SliceQueryPager.java
示例20: serialize
import org.apache.cassandra.db.filter.SliceQueryFilter; //导入依赖的package包/类
public void serialize(ReadCommand rm, DataOutput out, int version) throws IOException
{
SliceFromReadCommand realRM = (SliceFromReadCommand)rm;
out.writeBoolean(realRM.isDigestQuery());
out.writeUTF(realRM.ksName);
ByteBufferUtil.writeWithShortLength(realRM.key, out);
out.writeUTF(realRM.cfName);
out.writeLong(realRM.timestamp);
SliceQueryFilter.serializer.serialize(realRM.filter, out, version);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:11,代码来源:SliceFromReadCommand.java
注:本文中的org.apache.cassandra.db.filter.SliceQueryFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论