/** * @return true if column is restricted by some restriction, false otherwise */ public boolean isRestricted(ColumnDefinition column) { if (notNullColumns.contains(column)) return true; return getRestrictions(column.kind).getColumnDefs().contains(column); }
/** * Checks if the specified column is restricted by an EQ restriction. * * @param columnDef the column definition * @return <code>true</code> if the specified column is restricted by an EQ restiction, <code>false</code> * otherwise. */ public boolean isColumnRestrictedByEq(ColumnDefinition columnDef) { Set<Restriction> restrictions = getRestrictions(columnDef.kind).getRestrictions(columnDef); return restrictions.stream() .filter(SingleRestriction.class::isInstance) .anyMatch(p -> ((SingleRestriction) p).isEQ()); }
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; }
/** * Checks if the query need to use filtering. * @return <code>true</code> if the query need to use filtering, <code>false</code> otherwise. */ public boolean needFiltering() { int numberOfRestrictions = filterRestrictions.getCustomIndexExpressions().size(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) numberOfRestrictions += restrictions.size(); return numberOfRestrictions > 1 || (numberOfRestrictions == 0 && !clusteringColumnsRestrictions.isEmpty()) || (numberOfRestrictions != 0 && nonPrimaryKeyRestrictions.hasMultipleContains()); }
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; }
/** * Checks if the query need to use filtering. * @return <code>true</code> if the query need to use filtering, <code>false</code> otherwise. */ public boolean needFiltering() { int numberOfRestrictions = filterRestrictions.getCustomIndexExpressions().size(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) numberOfRestrictions += restrictions.size(); return numberOfRestrictions > 1 || (numberOfRestrictions == 0 && !clusteringColumnsRestrictions.isEmpty()) || (numberOfRestrictions != 0 && nonPrimaryKeyRestrictions.hasMultipleContains()); }
/** * @return true if column is restricted by some restriction, false otherwise */ public boolean isRestricted(ColumnDefinition column) { if (notNullColumns.contains(column)) return true; return getRestrictions(column.kind).getColumnDefs().contains(column); }
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; }
/** * Checks if the query need to use filtering. * @return <code>true</code> if the query need to use filtering, <code>false</code> otherwise. */ public boolean needFiltering() { int numberOfRestrictions = filterRestrictions.getCustomIndexExpressions().size(); for (Restrictions restrictions : filterRestrictions.getRestrictions()) numberOfRestrictions += restrictions.size(); return numberOfRestrictions > 1 || (numberOfRestrictions == 0 && !clusteringColumnsRestrictions.isEmpty()) || (numberOfRestrictions != 0 && nonPrimaryKeyRestrictions.hasMultipleContains()); }
/** * Checks if the specified column is restricted by an EQ restriction. * * @param columnDef the column definition * @return <code>true</code> if the specified column is restricted by an EQ restiction, <code>false</code> * otherwise. */ public boolean isColumnRestrictedByEq(ColumnDefinition columnDef) { Set<Restriction> restrictions = getRestrictions(columnDef.kind).getRestrictions(columnDef); return restrictions.stream() .filter(SingleRestriction.class::isInstance) .anyMatch(p -> ((SingleRestriction) p).isEQ()); }
/** * @return true if column is restricted by some restriction, false otherwise */ public boolean isRestricted(ColumnDefinition column) { if (notNullColumns.contains(column)) return true; return getRestrictions(column.kind).getColumnDefs().contains(column); }
/** * Checks if the specified column is restricted by an EQ restriction. * * @param columnDef the column definition * @return <code>true</code> if the specified column is restricted by an EQ restiction, <code>false</code> * otherwise. */ public boolean isColumnRestrictedByEq(ColumnDefinition columnDef) { Set<Restriction> restrictions = getRestrictions(columnDef.kind).getRestrictions(columnDef); return restrictions.stream() .filter(SingleRestriction.class::isInstance) .anyMatch(p -> ((SingleRestriction) p).isEQ()); }
/** * Returns the non-PK column that are restricted. If includeNotNullRestrictions is true, columns that are restricted * by an IS NOT NULL restriction will be included, otherwise they will not be included (unless another restriction * applies to them). */ public Set<ColumnDefinition> nonPKRestrictedColumns(boolean includeNotNullRestrictions) { Set<ColumnDefinition> columns = new HashSet<>(); for (Restrictions r : filterRestrictions.getRestrictions()) { for (ColumnDefinition def : r.getColumnDefs()) if (!def.isPrimaryKeyColumn()) columns.add(def); } if (includeNotNullRestrictions) { for (ColumnDefinition def : notNullColumns) { if (!def.isPrimaryKeyColumn()) columns.add(def); } } return columns; }
/** * Returns the non-PK column that are restricted. If includeNotNullRestrictions is true, columns that are restricted * by an IS NOT NULL restriction will be included, otherwise they will not be included (unless another restriction * applies to them). */ public Set<ColumnDefinition> nonPKRestrictedColumns(boolean includeNotNullRestrictions) { Set<ColumnDefinition> columns = new HashSet<>(); for (Restrictions r : filterRestrictions.getRestrictions()) { for (ColumnDefinition def : r.getColumnDefs()) if (!def.isPrimaryKeyColumn()) columns.add(def); } if (includeNotNullRestrictions) { for (ColumnDefinition def : notNullColumns) { if (!def.isPrimaryKeyColumn()) columns.add(def); } } return columns; }
/** * Returns the non-PK column that are restricted. If includeNotNullRestrictions is true, columns that are restricted * by an IS NOT NULL restriction will be included, otherwise they will not be included (unless another restriction * applies to them). */ public Set<ColumnDefinition> nonPKRestrictedColumns(boolean includeNotNullRestrictions) { Set<ColumnDefinition> columns = new HashSet<>(); for (Restrictions r : filterRestrictions.getRestrictions()) { for (ColumnDefinition def : r.getColumnDefs()) if (!def.isPrimaryKeyColumn()) columns.add(def); } if (includeNotNullRestrictions) { for (ColumnDefinition def : notNullColumns) { if (!def.isPrimaryKeyColumn()) columns.add(def); } } return columns; }