/** * Returns a relation on the SuperColumn key */ private static Pair<ColumnDefinition, Relation> getSuperColumnKeyRelation(List<Relation> relations, CFMetaData cfm) { for (int i = 0; i < relations.size(); i++) { SingleColumnRelation relation = (SingleColumnRelation) relations.get(i); ColumnDefinition def = relation.getEntity().prepare(cfm); if (cfm.isSuperColumnKeyColumn(def)) return Pair.create(def, relation); } return null; }
private Map<ColumnDefinition, Integer> getOrderingIndex(CFMetaData cfm, Selection selection, boolean isJson) throws InvalidRequestException { // If we order post-query (see orderResults), the sorted column needs to be in the ResultSet for sorting, // even if we don't // ultimately ship them to the client (CASSANDRA-4911). for (ColumnDefinition.Raw raw : parameters.orderings.keySet()) { final ColumnDefinition def = raw.prepare(cfm); selection.addColumnForOrdering(def); } return selection.getOrderingIndex(isJson); }
@Override protected Restriction newIsNotRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); // currently enforced by the grammar assert value == Constants.NULL_LITERAL : "Expected null literal for IS NOT relation: " + this.toString(); return new SingleColumnRestriction.IsNotNullRestriction(columnDef); }
public IndexTarget prepare(CFMetaData cfm) { // Until we've prepared the target column, we can't be certain about the target type // because (for backwards compatibility) an index on a collection's values uses the // same syntax as an index on a regular column (i.e. the 'values' in // 'CREATE INDEX on table(values(collection));' is optional). So we correct the target type // when the target column is a collection & the target type is SIMPLE. ColumnDefinition columnDef = column.prepare(cfm); Type actualType = (type == Type.SIMPLE && columnDef.type.isCollection()) ? Type.VALUES : type; return new IndexTarget(columnDef.name, actualType); } }
@Override protected Restriction newLikeRestriction(CFMetaData cfm, VariableSpecifications boundNames, Operator operator) throws InvalidRequestException { if (mapKey != null) throw invalidRequest("%s can't be used with collections.", operator()); ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.LikeRestriction(columnDef, operator, term); }
public WritetimeOrTTL prepare(CFMetaData cfm) { return new WritetimeOrTTL(id.prepare(cfm), isWritetime); } }
public WritetimeOrTTL prepare(CFMetaData cfm) { return new WritetimeOrTTL(id.prepare(cfm), isWritetime); } }
@Override protected Restriction newLikeRestriction(CFMetaData cfm, VariableSpecifications boundNames, Operator operator) throws InvalidRequestException { if (mapKey != null) throw invalidRequest("%s can't be used with collections.", operator()); ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.LikeRestriction(columnDef, operator, term); }
@Override protected Restriction newContainsRestriction(CFMetaData cfm, VariableSpecifications boundNames, boolean isKey) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.ContainsRestriction(columnDef, term, isKey); }
@Override protected Restriction newIsNotRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); // currently enforced by the grammar assert value == Constants.NULL_LITERAL : "Expected null literal for IS NOT relation: " + this.toString(); return new SingleColumnRestriction.IsNotNullRestriction(columnDef); }
public IndexTarget prepare(CFMetaData cfm) { // Until we've prepared the target column, we can't be certain about the target type // because (for backwards compatibility) an index on a collection's values uses the // same syntax as an index on a regular column (i.e. the 'values' in // 'CREATE INDEX on table(values(collection));' is optional). So we correct the target type // when the target column is a collection & the target type is SIMPLE. ColumnDefinition columnDef = column.prepare(cfm); Type actualType = (type == Type.SIMPLE && columnDef.type.isCollection()) ? Type.VALUES : type; return new IndexTarget(columnDef.name, actualType); } }
public IndexTarget prepare(CFMetaData cfm) { // Until we've prepared the target column, we can't be certain about the target type // because (for backwards compatibility) an index on a collection's values uses the // same syntax as an index on a regular column (i.e. the 'values' in // 'CREATE INDEX on table(values(collection));' is optional). So we correct the target type // when the target column is a collection & the target type is SIMPLE. ColumnDefinition columnDef = column.prepare(cfm); Type actualType = (type == Type.SIMPLE && columnDef.type.isCollection()) ? Type.VALUES : type; return new IndexTarget(columnDef.name, actualType); } }
@Override protected Restriction newIsNotRestriction(CFMetaData cfm, VariableSpecifications boundNames) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); // currently enforced by the grammar assert value == Constants.NULL_LITERAL : "Expected null literal for IS NOT relation: " + this.toString(); return new SingleColumnRestriction.IsNotNullRestriction(columnDef); }
@Override protected Restriction newContainsRestriction(CFMetaData cfm, VariableSpecifications boundNames, boolean isKey) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.ContainsRestriction(columnDef, term, isKey); }
/** * Retrieves the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code>. * * @param cfm the column family meta data * @param rawId the raw <code>ColumnIdentifier</code> * @return the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code> */ protected static ColumnDefinition getColumnDefinition(CFMetaData cfm, Raw rawId) { return rawId.prepare(cfm); } }
/** * Retrieves the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code>. * * @param cfm the column family meta data * @param rawId the raw <code>ColumnIdentifier</code> * @return the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code> */ protected static ColumnDefinition getColumnDefinition(CFMetaData cfm, Raw rawId) { return rawId.prepare(cfm); } }
@Override protected Restriction newContainsRestriction(CFMetaData cfm, VariableSpecifications boundNames, boolean isKey) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.ContainsRestriction(columnDef, term, isKey); }
public WritetimeOrTTL prepare(CFMetaData cfm) { return new WritetimeOrTTL(id.prepare(cfm), isWritetime); } }
@Override protected Restriction newLikeRestriction(CFMetaData cfm, VariableSpecifications boundNames, Operator operator) throws InvalidRequestException { if (mapKey != null) throw invalidRequest("%s can't be used with collections.", operator()); ColumnDefinition columnDef = entity.prepare(cfm); Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.LikeRestriction(columnDef, operator, term); }
/** * Retrieves the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code>. * * @param cfm the column family meta data * @param rawId the raw <code>ColumnIdentifier</code> * @return the <code>ColumnDefinition</code> corresponding to the specified raw <code>ColumnIdentifier</code> */ protected static ColumnDefinition getColumnDefinition(CFMetaData cfm, Raw rawId) { return rawId.prepare(cfm); } }