List of usage examples for org.apache.cassandra.service QueryState getClientState
public ClientState getClientState()
From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java
License:Apache License
@Override /** {@inheritDoc} */ public ResultMessage process(String query, QueryState state, QueryOptions options, Map<String, ByteBuffer> customPayload) { ParsedStatement.Prepared p = QueryProcessor.getStatement(query, state.getClientState()); options.prepare(p.boundNames);/*from w ww .j a v a 2 s.c o m*/ CQLStatement prepared = p.statement; if (prepared.getBoundTerms() != options.getValues().size()) { throw new InvalidRequestException("Invalid amount of bind variables"); } if (!state.getClientState().isInternal) { QueryProcessor.metrics.regularStatementsExecuted.inc(); } return processStatement(prepared, state, options); }
From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java
License:Apache License
public ResultMessage processStatement(CQLStatement statement, QueryState state, QueryOptions options) { logger.trace("Process {} @CL.{}", statement, options.getConsistency()); ClientState clientState = state.getClientState(); statement.checkAccess(clientState);/*from w ww . j a v a 2 s . c om*/ statement.validate(clientState); // Intercept Lucene index searches if (statement instanceof SelectStatement) { SelectStatement select = (SelectStatement) statement; List<RowFilter.Expression> expressions = select.getRowFilter(options).getExpressions(); for (RowFilter.Expression expression : expressions) { if (expression.isCustom()) { RowFilter.CustomExpression customExpression = (RowFilter.CustomExpression) expression; String clazz = customExpression.getTargetIndex().options .get(IndexTarget.CUSTOM_INDEX_OPTION_NAME); if (clazz.equals(Index.class.getCanonicalName())) { TimeCounter time = TimeCounter.create().start(); try { return process(select, state, options, customExpression); } catch (ReflectiveOperationException e) { throw new IndexException(e); } finally { logger.debug("Lucene search total time: {}\n", time.stop()); } } } } } return execute(statement, state, options); }