List of usage examples for org.apache.cassandra.cql3.statements SelectStatement keyspace
public String keyspace()
From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java
License:Apache License
private ResultMessage process(SelectStatement select, QueryState state, QueryOptions options, RowFilter.CustomExpression expression) throws ReflectiveOperationException { // Validate expression ColumnFamilyStore cfs = Keyspace.open(select.keyspace()).getColumnFamilyStore(select.columnFamily()); Index index = (Index) cfs.indexManager.getIndex(expression.getTargetIndex()); Search search = index.validate(expression); // Check paging int limit = select.getLimit(options); int page = getPageSize(select, options); if (search.isTopK()) { if (limit == Integer.MAX_VALUE) { // Avoid unlimited throw new InvalidRequestException( "Top-k searches don't support paging, so a cautious LIMIT clause should be provided " + "to prevent excessive memory consumption."); } else if (page < limit) { String json = UTF8Type.instance.compose(expression.getValue()); logger.warn("Disabling paging of {} rows per page for top-k search requesting {} rows: {}", page, limit, json);// www.j a v a2 s .c om return executeWithoutPaging(select, state, options); } } // Process return execute(select, state, options); }
From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java
License:Apache License
public ResultMessage.Rows executeWithoutPaging(SelectStatement select, QueryState state, QueryOptions options) throws ReflectiveOperationException { ConsistencyLevel cl = options.getConsistency(); checkNotNull(cl, "Invalid empty consistency level"); cl.validateForRead(select.keyspace()); int nowInSec = FBUtilities.nowInSeconds(); int userLimit = select.getLimit(options); ReadQuery query = select.getQuery(options, nowInSec, userLimit); Method method = select.getClass().getDeclaredMethod("execute", ReadQuery.class, QueryOptions.class, QueryState.class, int.class, int.class); method.setAccessible(true);/*www . jav a2 s.co m*/ return (ResultMessage.Rows) method.invoke(select, query, options, state, nowInSec, userLimit); }