public RowFilter getRowFilter(SecondaryIndexManager indexManager, QueryOptions options) { if (filterRestrictions.isEmpty()) return RowFilter.NONE; RowFilter filter = RowFilter.create(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) restrictions.addRowFilterTo(filter, indexManager, options); for (CustomIndexExpression expression : filterRestrictions.getCustomIndexExpressions()) expression.addToRowFilter(filter, cfm, options); return filter; }
public final void customIndexExpression(WhereClause.Builder clause) throws RecognitionException { Term.Raw t =null; IndexName name = new IndexName(); try { // Parser.g:341:5: ( 'expr(' idxName[name] ',' t= term ')' ) // Parser.g:341:7: 'expr(' idxName[name] ',' t= term ')' { match(input,202,FOLLOW_202_in_customIndexExpression1830); pushFollow(FOLLOW_idxName_in_customIndexExpression1832); idxName(name); state._fsp--; match(input,188,FOLLOW_188_in_customIndexExpression1835); pushFollow(FOLLOW_term_in_customIndexExpression1839); t=term(); state._fsp--; match(input,185,FOLLOW_185_in_customIndexExpression1841); clause.add(new CustomIndexExpression(name, t)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "customIndexExpression"
private void processCustomIndexExpressions(List<CustomIndexExpression> expressions, VariableSpecifications boundNames, SecondaryIndexManager indexManager) { if (!MessagingService.instance().areAllNodesAtLeast30()) throw new InvalidRequestException("Please upgrade all nodes to at least 3.0 before using custom index expressions"); if (expressions.size() > 1) throw new InvalidRequestException(IndexRestrictions.MULTIPLE_EXPRESSIONS); CustomIndexExpression expression = expressions.get(0); CFName cfName = expression.targetIndex.getCfName(); if (cfName.hasKeyspace() && !expression.targetIndex.getKeyspace().equals(cfm.ksName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (cfName.getColumnFamily() != null && !cfName.getColumnFamily().equals(cfm.cfName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (!cfm.getIndexes().has(expression.targetIndex.getIdx())) throw IndexRestrictions.indexNotFound(expression.targetIndex, cfm); Index index = indexManager.getIndex(cfm.getIndexes().get(expression.targetIndex.getIdx()).get()); if (!index.getIndexMetadata().isCustom()) throw IndexRestrictions.nonCustomIndexInExpression(expression.targetIndex); AbstractType<?> expressionType = index.customExpressionValueType(); if (expressionType == null) throw IndexRestrictions.customExpressionNotSupported(expression.targetIndex); expression.prepareValue(cfm, expressionType, boundNames); filterRestrictions.add(expression); }
public final void customIndexExpression(WhereClause.Builder clause) throws RecognitionException { Term.Raw t =null; IndexName name = new IndexName(); try { // Parser.g:341:5: ( 'expr(' idxName[name] ',' t= term ')' ) // Parser.g:341:7: 'expr(' idxName[name] ',' t= term ')' { match(input,202,FOLLOW_202_in_customIndexExpression1830); pushFollow(FOLLOW_idxName_in_customIndexExpression1832); idxName(name); state._fsp--; match(input,188,FOLLOW_188_in_customIndexExpression1835); pushFollow(FOLLOW_term_in_customIndexExpression1839); t=term(); state._fsp--; match(input,185,FOLLOW_185_in_customIndexExpression1841); clause.add(new CustomIndexExpression(name, t)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "customIndexExpression"
private void processCustomIndexExpressions(List<CustomIndexExpression> expressions, VariableSpecifications boundNames, SecondaryIndexManager indexManager) { if (!MessagingService.instance().areAllNodesAtLeast30()) throw new InvalidRequestException("Please upgrade all nodes to at least 3.0 before using custom index expressions"); if (expressions.size() > 1) throw new InvalidRequestException(IndexRestrictions.MULTIPLE_EXPRESSIONS); CustomIndexExpression expression = expressions.get(0); CFName cfName = expression.targetIndex.getCfName(); if (cfName.hasKeyspace() && !expression.targetIndex.getKeyspace().equals(cfm.ksName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (cfName.getColumnFamily() != null && !cfName.getColumnFamily().equals(cfm.cfName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (!cfm.getIndexes().has(expression.targetIndex.getIdx())) throw IndexRestrictions.indexNotFound(expression.targetIndex, cfm); Index index = indexManager.getIndex(cfm.getIndexes().get(expression.targetIndex.getIdx()).get()); if (!index.getIndexMetadata().isCustom()) throw IndexRestrictions.nonCustomIndexInExpression(expression.targetIndex); AbstractType<?> expressionType = index.customExpressionValueType(); if (expressionType == null) throw IndexRestrictions.customExpressionNotSupported(expression.targetIndex); expression.prepareValue(cfm, expressionType, boundNames); filterRestrictions.add(expression); }
public RowFilter getRowFilter(SecondaryIndexManager indexManager, QueryOptions options) { if (filterRestrictions.isEmpty()) return RowFilter.NONE; RowFilter filter = RowFilter.create(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) restrictions.addRowFilterTo(filter, indexManager, options); for (CustomIndexExpression expression : filterRestrictions.getCustomIndexExpressions()) expression.addToRowFilter(filter, cfm, options); return filter; }
public final void customIndexExpression(WhereClause.Builder clause) throws RecognitionException { Term.Raw t =null; IndexName name = new IndexName(); try { // Parser.g:341:5: ( 'expr(' idxName[name] ',' t= term ')' ) // Parser.g:341:7: 'expr(' idxName[name] ',' t= term ')' { match(input,202,FOLLOW_202_in_customIndexExpression1830); pushFollow(FOLLOW_idxName_in_customIndexExpression1832); idxName(name); state._fsp--; match(input,188,FOLLOW_188_in_customIndexExpression1835); pushFollow(FOLLOW_term_in_customIndexExpression1839); t=term(); state._fsp--; match(input,185,FOLLOW_185_in_customIndexExpression1841); clause.add(new CustomIndexExpression(name, t)); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving } } // $ANTLR end "customIndexExpression"
private void processCustomIndexExpressions(List<CustomIndexExpression> expressions, VariableSpecifications boundNames, SecondaryIndexManager indexManager) { if (!MessagingService.instance().areAllNodesAtLeast30()) throw new InvalidRequestException("Please upgrade all nodes to at least 3.0 before using custom index expressions"); if (expressions.size() > 1) throw new InvalidRequestException(IndexRestrictions.MULTIPLE_EXPRESSIONS); CustomIndexExpression expression = expressions.get(0); CFName cfName = expression.targetIndex.getCfName(); if (cfName.hasKeyspace() && !expression.targetIndex.getKeyspace().equals(cfm.ksName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (cfName.getColumnFamily() != null && !cfName.getColumnFamily().equals(cfm.cfName)) throw IndexRestrictions.invalidIndex(expression.targetIndex, cfm); if (!cfm.getIndexes().has(expression.targetIndex.getIdx())) throw IndexRestrictions.indexNotFound(expression.targetIndex, cfm); Index index = indexManager.getIndex(cfm.getIndexes().get(expression.targetIndex.getIdx()).get()); if (!index.getIndexMetadata().isCustom()) throw IndexRestrictions.nonCustomIndexInExpression(expression.targetIndex); AbstractType<?> expressionType = index.customExpressionValueType(); if (expressionType == null) throw IndexRestrictions.customExpressionNotSupported(expression.targetIndex); expression.prepareValue(cfm, expressionType, boundNames); filterRestrictions.add(expression); }
public RowFilter getRowFilter(SecondaryIndexManager indexManager, QueryOptions options) { if (filterRestrictions.isEmpty()) return RowFilter.NONE; RowFilter filter = RowFilter.create(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) restrictions.addRowFilterTo(filter, indexManager, options); for (CustomIndexExpression expression : filterRestrictions.getCustomIndexExpressions()) expression.addToRowFilter(filter, cfm, options); return filter; }