@Override public int compare(AbstractType<?> type, AbstractType<?> otherType) { if (!type.getClass().equals(otherType.getClass())) throw new IllegalArgumentException(String.format("Trying to compare 2 different types: %s and %s", type, otherType)); if (type.equals(otherType)) return 0; // The only case where 2 types can differ is if they contains some UDTs and one of them has more // fields (due to an ALTER type ADD) than in the other type. In this case we need to pick the type with // the bigger amount of fields. if (type.isUDT()) return compareUserType((UserType) type, (UserType) otherType); if (type.isTuple()) return compareTuple((TupleType) type, (TupleType) otherType); if (type.isCollection()) return compareCollectionTypes(type, otherType); if (type instanceof CompositeType) return compareCompositeTypes((CompositeType) type, (CompositeType) otherType); // In theory we should never reach that point but to be on the safe side we allow it. return 0; }
@Override public int compare(AbstractType<?> type, AbstractType<?> otherType) { if (!type.getClass().equals(otherType.getClass())) throw new IllegalArgumentException(String.format("Trying to compare 2 different types: %s and %s", type, otherType)); if (type.equals(otherType)) return 0; // The only case where 2 types can differ is if they contains some UDTs and one of them has more // fields (due to an ALTER type ADD) than in the other type. In this case we need to pick the type with // the bigger amount of fields. if (type.isUDT()) return compareUserType((UserType) type, (UserType) otherType); if (type.isTuple()) return compareTuple((TupleType) type, (TupleType) otherType); if (type.isCollection()) return compareCollectionTypes(type, otherType); if (type instanceof CompositeType) return compareCompositeTypes((CompositeType) type, (CompositeType) otherType); // In theory we should never reach that point but to be on the safe side we allow it. return 0; }
@Override public int compare(AbstractType<?> type, AbstractType<?> otherType) { if (!type.getClass().equals(otherType.getClass())) throw new IllegalArgumentException(String.format("Trying to compare 2 different types: %s and %s", type, otherType)); if (type.equals(otherType)) return 0; // The only case where 2 types can differ is if they contains some UDTs and one of them has more // fields (due to an ALTER type ADD) than in the other type. In this case we need to pick the type with // the bigger amount of fields. if (type.isUDT()) return compareUserType((UserType) type, (UserType) otherType); if (type.isTuple()) return compareTuple((TupleType) type, (TupleType) otherType); if (type.isCollection()) return compareCollectionTypes(type, otherType); if (type instanceof CompositeType) return compareCompositeTypes((CompositeType) type, (CompositeType) otherType); // In theory we should never reach that point but to be on the safe side we allow it. return 0; }
private void validateOperationOnDurations(AbstractType<?> type) { if (type.referencesDuration() && operator.isSlice()) { checkFalse(type.isCollection(), "Slice conditions are not supported on collections containing durations"); checkFalse(type.isTuple(), "Slice conditions are not supported on tuples containing durations"); checkFalse(type.isUDT(), "Slice conditions are not supported on UDTs containing durations"); throw invalidRequest("Slice conditions are not supported on durations", operator); } } }
private void validateOperationOnDurations(AbstractType<?> type) { if (type.referencesDuration() && operator.isSlice()) { checkFalse(type.isCollection(), "Slice conditions are not supported on collections containing durations"); checkFalse(type.isTuple(), "Slice conditions are not supported on tuples containing durations"); checkFalse(type.isUDT(), "Slice conditions are not supported on UDTs containing durations"); throw invalidRequest("Slice conditions are not supported on durations", operator); } } }
private void validateOperationOnDurations(AbstractType<?> type) { if (type.referencesDuration() && operator.isSlice()) { checkFalse(type.isCollection(), "Slice conditions are not supported on collections containing durations"); checkFalse(type.isTuple(), "Slice conditions are not supported on tuples containing durations"); checkFalse(type.isUDT(), "Slice conditions are not supported on UDTs containing durations"); throw invalidRequest("Slice conditions are not supported on durations", operator); } } }
@Override protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); if (columnDef.type.referencesDuration()) { checkFalse(columnDef.type.isCollection(), "Slice restrictions are not supported on collections containing durations"); checkFalse(columnDef.type.isTuple(), "Slice restrictions are not supported on tuples containing durations"); checkFalse(columnDef.type.isUDT(), "Slice restrictions are not supported on UDTs containing durations"); throw invalidRequest("Slice restrictions are not supported on duration columns"); } Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.SliceRestriction(columnDef, bound, inclusive, term); }
@Override protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); if (columnDef.type.referencesDuration()) { checkFalse(columnDef.type.isCollection(), "Slice restrictions are not supported on collections containing durations"); checkFalse(columnDef.type.isTuple(), "Slice restrictions are not supported on tuples containing durations"); checkFalse(columnDef.type.isUDT(), "Slice restrictions are not supported on UDTs containing durations"); throw invalidRequest("Slice restrictions are not supported on duration columns"); } Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.SliceRestriction(columnDef, bound, inclusive, term); }
@Override protected Restriction newSliceRestriction(CFMetaData cfm, VariableSpecifications boundNames, Bound bound, boolean inclusive) throws InvalidRequestException { ColumnDefinition columnDef = entity.prepare(cfm); if (columnDef.type.referencesDuration()) { checkFalse(columnDef.type.isCollection(), "Slice restrictions are not supported on collections containing durations"); checkFalse(columnDef.type.isTuple(), "Slice restrictions are not supported on tuples containing durations"); checkFalse(columnDef.type.isUDT(), "Slice restrictions are not supported on UDTs containing durations"); throw invalidRequest("Slice restrictions are not supported on duration columns"); } Term term = toTerm(toReceivers(columnDef), value, cfm.ksName, boundNames); return new SingleColumnRestriction.SliceRestriction(columnDef, bound, inclusive, term); }
checkFalse(cd.type.isTuple(), "Secondary indexes are not supported on tuples containing durations"); checkFalse(cd.type.isUDT(), "Secondary indexes are not supported on UDTs containing durations"); throw invalidRequest("Secondary indexes are not supported on duration columns");
checkFalse(cd.type.isTuple(), "Secondary indexes are not supported on tuples containing durations"); checkFalse(cd.type.isUDT(), "Secondary indexes are not supported on UDTs containing durations"); throw invalidRequest("Secondary indexes are not supported on duration columns");
checkFalse(cd.type.isTuple(), "Secondary indexes are not supported on tuples containing durations"); checkFalse(cd.type.isUDT(), "Secondary indexes are not supported on UDTs containing durations"); throw invalidRequest("Secondary indexes are not supported on duration columns");