Search in sources :

Example 26 with Type

use of org.apache.cassandra.cql3.statements.schema.IndexTarget.Type in project cassandra by apache.

the class CreateAggregateStatement method apply.

public Keyspaces apply(Keyspaces schema) {
    if (ifNotExists && orReplace)
        throw ire("Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives");
    rawArgumentTypes.stream().filter(raw -> !raw.isTuple() && raw.isFrozen()).findFirst().ifPresent(t -> {
        throw ire("Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'", t, t);
    });
    if (!rawStateType.isTuple() && rawStateType.isFrozen())
        throw ire("State type '%s' cannot be frozen; remove frozen<> modifier from '%s'", rawStateType, rawStateType);
    KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
    if (null == keyspace)
        throw ire("Keyspace '%s' doesn't exist", keyspaceName);
    /*
         * Resolve the state function
         */
    List<AbstractType<?>> argumentTypes = rawArgumentTypes.stream().map(t -> t.prepare(keyspaceName, keyspace.types).getType()).collect(toList());
    AbstractType<?> stateType = rawStateType.prepare(keyspaceName, keyspace.types).getType();
    List<AbstractType<?>> stateFunctionArguments = Lists.newArrayList(concat(singleton(stateType), argumentTypes));
    Function stateFunction = keyspace.functions.find(stateFunctionName, stateFunctionArguments).orElseThrow(() -> ire("State function %s doesn't exist", stateFunctionString()));
    if (stateFunction.isAggregate())
        throw ire("State function %s isn't a scalar function", stateFunctionString());
    if (!stateFunction.returnType().equals(stateType)) {
        throw ire("State function %s return type must be the same as the first argument type - check STYPE, argument and return types", stateFunctionString());
    }
    /*
         * Resolve the final function and return type
         */
    Function finalFunction = null;
    AbstractType<?> returnType = stateFunction.returnType();
    if (null != finalFunctionName) {
        finalFunction = keyspace.functions.find(finalFunctionName, singletonList(stateType)).orElse(null);
        if (null == finalFunction)
            throw ire("Final function %s doesn't exist", finalFunctionString());
        if (finalFunction.isAggregate())
            throw ire("Final function %s isn't a scalar function", finalFunctionString());
        // override return type with that of the final function
        returnType = finalFunction.returnType();
    }
    /*
         * Validate initial condition
         */
    ByteBuffer initialValue = null;
    if (null != rawInitialValue) {
        initialValue = Terms.asBytes(keyspaceName, rawInitialValue.toString(), stateType);
        if (null != initialValue) {
            try {
                stateType.validate(initialValue);
            } catch (MarshalException e) {
                throw ire("Invalid value for INITCOND of type %s", stateType.asCQL3Type());
            }
        }
        // Converts initcond to a CQL literal and parse it back to avoid another CASSANDRA-11064
        String initialValueString = stateType.asCQL3Type().toCQLLiteral(initialValue, ProtocolVersion.CURRENT);
        assert Objects.equal(initialValue, Terms.asBytes(keyspaceName, initialValueString, stateType));
        if (Constants.NULL_LITERAL != rawInitialValue && UDHelper.isNullOrEmpty(stateType, initialValue))
            throw ire("INITCOND must not be empty for all types except TEXT, ASCII, BLOB");
    }
    if (!((UDFunction) stateFunction).isCalledOnNullInput() && null == initialValue) {
        throw ire("Cannot create aggregate '%s' without INITCOND because state function %s does not accept 'null' arguments", aggregateName, stateFunctionName);
    }
    /*
         * Create or replace
         */
    UDAggregate aggregate = new UDAggregate(new FunctionName(keyspaceName, aggregateName), argumentTypes, returnType, (ScalarFunction) stateFunction, (ScalarFunction) finalFunction, initialValue);
    Function existingAggregate = keyspace.functions.find(aggregate.name(), argumentTypes).orElse(null);
    if (null != existingAggregate) {
        if (!existingAggregate.isAggregate())
            throw ire("Aggregate '%s' cannot replace a function", aggregateName);
        if (ifNotExists)
            return schema;
        if (!orReplace)
            throw ire("Aggregate '%s' already exists", aggregateName);
        if (!returnType.isCompatibleWith(existingAggregate.returnType())) {
            throw ire("Cannot replace aggregate '%s', the new return type %s isn't compatible with the return type %s of existing function", aggregateName, returnType.asCQL3Type(), existingAggregate.returnType().asCQL3Type());
        }
    }
    return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.functions.withAddedOrUpdated(aggregate)));
}
Also used : AuditLogContext(org.apache.cassandra.audit.AuditLogContext) Change(org.apache.cassandra.transport.Event.SchemaChange.Change) FunctionResource(org.apache.cassandra.auth.FunctionResource) Iterables.transform(com.google.common.collect.Iterables.transform) Permission(org.apache.cassandra.auth.Permission) IResource(org.apache.cassandra.auth.IResource) AbstractType(org.apache.cassandra.db.marshal.AbstractType) ByteBuffer(java.nio.ByteBuffer) org.apache.cassandra.cql3(org.apache.cassandra.cql3) Schema(org.apache.cassandra.schema.Schema) Collections.singletonList(java.util.Collections.singletonList) Lists(com.google.common.collect.Lists) String.join(java.lang.String.join) Collections.singleton(java.util.Collections.singleton) Iterables.concat(com.google.common.collect.Iterables.concat) ProtocolVersion(org.apache.cassandra.transport.ProtocolVersion) org.apache.cassandra.cql3.functions(org.apache.cassandra.cql3.functions) FunctionsDiff(org.apache.cassandra.schema.Functions.FunctionsDiff) Objects(com.google.common.base.Objects) KeyspacesDiff(org.apache.cassandra.schema.Keyspaces.KeyspacesDiff) ImmutableSet(com.google.common.collect.ImmutableSet) Keyspaces(org.apache.cassandra.schema.Keyspaces) SchemaChange(org.apache.cassandra.transport.Event.SchemaChange) ClientState(org.apache.cassandra.service.ClientState) Set(java.util.Set) String.format(java.lang.String.format) AuditLogEntryType(org.apache.cassandra.audit.AuditLogEntryType) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Target(org.apache.cassandra.transport.Event.SchemaChange.Target) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) MarshalException(org.apache.cassandra.serializers.MarshalException) MarshalException(org.apache.cassandra.serializers.MarshalException) AbstractType(org.apache.cassandra.db.marshal.AbstractType) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) ByteBuffer(java.nio.ByteBuffer)

Example 27 with Type

use of org.apache.cassandra.cql3.statements.schema.IndexTarget.Type in project cassandra by apache.

the class CreateViewStatement method apply.

public Keyspaces apply(Keyspaces schema) {
    if (!DatabaseDescriptor.getMaterializedViewsEnabled())
        throw ire("Materialized views are disabled. Enable in cassandra.yaml to use.");
    /*
         * Basic dependency validations
         */
    KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
    if (null == keyspace)
        throw ire("Keyspace '%s' doesn't exist", keyspaceName);
    if (keyspace.createReplicationStrategy().hasTransientReplicas())
        throw new InvalidRequestException("Materialized views are not supported on transiently replicated keyspaces");
    TableMetadata table = keyspace.tables.getNullable(tableName);
    if (null == table)
        throw ire("Base table '%s' doesn't exist", tableName);
    if (keyspace.hasTable(viewName))
        throw ire("Cannot create materialized view '%s' - a table with the same name already exists", viewName);
    if (keyspace.hasView(viewName)) {
        if (ifNotExists)
            return schema;
        throw new AlreadyExistsException(keyspaceName, viewName);
    }
    if (table.isCounter())
        throw ire("Materialized views are not supported on counter tables");
    if (table.isView())
        throw ire("Materialized views cannot be created against other materialized views");
    // Guardrails on table properties
    Guardrails.tableProperties.guard(attrs.updatedProperties(), attrs::removeProperty, state);
    // Guardrail to limit number of mvs per table
    Iterable<ViewMetadata> tableViews = keyspace.views.forTable(table.id);
    Guardrails.materializedViewsPerTable.guard(Iterables.size(tableViews) + 1, String.format("%s on table %s", viewName, table.name), state);
    if (table.params.gcGraceSeconds == 0) {
        throw ire("Cannot create materialized view '%s' for base table " + "'%s' with gc_grace_seconds of 0, since this value is " + "used to TTL undelivered updates. Setting gc_grace_seconds" + " too low might cause undelivered updates to expire " + "before being replayed.", viewName, tableName);
    }
    /*
         * Process SELECT clause
         */
    Set<ColumnIdentifier> selectedColumns = new HashSet<>();
    if (// SELECT *
    rawColumns.isEmpty())
        table.columns().forEach(c -> selectedColumns.add(c.name));
    rawColumns.forEach(selector -> {
        if (null != selector.alias)
            throw ire("Cannot use aliases when defining a materialized view (got %s)", selector);
        if (!(selector.selectable instanceof Selectable.RawIdentifier))
            throw ire("Can only select columns by name when defining a materialized view (got %s)", selector.selectable);
        // will throw IRE if the column doesn't exist in the base table
        ColumnMetadata column = (ColumnMetadata) selector.selectable.prepare(table);
        selectedColumns.add(column.name);
    });
    selectedColumns.stream().map(table::getColumn).filter(ColumnMetadata::isStatic).findAny().ifPresent(c -> {
        throw ire("Cannot include static column '%s' in materialized view '%s'", c, viewName);
    });
    if (partitionKeyColumns.isEmpty())
        throw ire("Must provide at least one partition key column for materialized view '%s'", viewName);
    HashSet<ColumnIdentifier> primaryKeyColumns = new HashSet<>();
    concat(partitionKeyColumns, clusteringColumns).forEach(name -> {
        ColumnMetadata column = table.getColumn(name);
        if (null == column || !selectedColumns.contains(name))
            throw ire("Unknown column '%s' referenced in PRIMARY KEY for materialized view '%s'", name, viewName);
        if (!primaryKeyColumns.add(name))
            throw ire("Duplicate column '%s' in PRIMARY KEY clause for materialized view '%s'", name, viewName);
        AbstractType<?> type = column.type;
        if (type.isMultiCell()) {
            if (type.isCollection())
                throw ire("Invalid non-frozen collection type '%s' for PRIMARY KEY column '%s'", type, name);
            else
                throw ire("Invalid non-frozen user-defined type '%s' for PRIMARY KEY column '%s'", type, name);
        }
        if (type.isCounter())
            throw ire("counter type is not supported for PRIMARY KEY column '%s'", name);
        if (type.referencesDuration())
            throw ire("duration type is not supported for PRIMARY KEY column '%s'", name);
    });
    // If we give a clustering order, we must explicitly do so for all aliases and in the order of the PK
    if (!clusteringOrder.isEmpty() && !clusteringColumns.equals(new ArrayList<>(clusteringOrder.keySet())))
        throw ire("Clustering key columns must exactly match columns in CLUSTERING ORDER BY directive");
    /*
         * We need to include all of the primary key columns from the base table in order to make sure that we do not
         * overwrite values in the view. We cannot support "collapsing" the base table into a smaller number of rows in
         * the view because if we need to generate a tombstone, we have no way of knowing which value is currently being
         * used in the view and whether or not to generate a tombstone. In order to not surprise our users, we require
         * that they include all of the columns. We provide them with a list of all of the columns left to include.
         */
    List<ColumnIdentifier> missingPrimaryKeyColumns = Lists.newArrayList(filter(transform(table.primaryKeyColumns(), c -> c.name), c -> !primaryKeyColumns.contains(c)));
    if (!missingPrimaryKeyColumns.isEmpty()) {
        throw ire("Cannot create materialized view '%s' without primary key columns %s from base table '%s'", viewName, join(", ", transform(missingPrimaryKeyColumns, ColumnIdentifier::toString)), tableName);
    }
    Set<ColumnIdentifier> regularBaseTableColumnsInViewPrimaryKey = new HashSet<>(primaryKeyColumns);
    transform(table.primaryKeyColumns(), c -> c.name).forEach(regularBaseTableColumnsInViewPrimaryKey::remove);
    if (regularBaseTableColumnsInViewPrimaryKey.size() > 1) {
        throw ire("Cannot include more than one non-primary key column in materialized view primary key (got %s)", join(", ", transform(regularBaseTableColumnsInViewPrimaryKey, ColumnIdentifier::toString)));
    }
    /*
         * Process WHERE clause
         */
    if (whereClause.containsTokenRelations())
        throw new InvalidRequestException("Cannot use token relation when defining a materialized view");
    if (whereClause.containsCustomExpressions())
        throw ire("WHERE clause for materialized view '%s' cannot contain custom index expressions", viewName);
    StatementRestrictions restrictions = new StatementRestrictions(StatementType.SELECT, table, whereClause, VariableSpecifications.empty(), false, false, true, true);
    List<ColumnIdentifier> nonRestrictedPrimaryKeyColumns = Lists.newArrayList(filter(primaryKeyColumns, name -> !restrictions.isRestricted(table.getColumn(name))));
    if (!nonRestrictedPrimaryKeyColumns.isEmpty()) {
        throw ire("Primary key columns %s must be restricted with 'IS NOT NULL' or otherwise", join(", ", transform(nonRestrictedPrimaryKeyColumns, ColumnIdentifier::toString)));
    }
    // See CASSANDRA-13798
    Set<ColumnMetadata> restrictedNonPrimaryKeyColumns = restrictions.nonPKRestrictedColumns(false);
    if (!restrictedNonPrimaryKeyColumns.isEmpty() && !Boolean.getBoolean("cassandra.mv.allow_filtering_nonkey_columns_unsafe")) {
        throw ire("Non-primary key columns can only be restricted with 'IS NOT NULL' (got: %s restricted illegally)", join(",", transform(restrictedNonPrimaryKeyColumns, ColumnMetadata::toString)));
    }
    /*
         * Validate WITH params
         */
    attrs.validate();
    if (attrs.hasOption(TableParams.Option.DEFAULT_TIME_TO_LIVE)) {
        throw ire("Cannot set default_time_to_live for a materialized view. " + "Data in a materialized view always expire at the same time than " + "the corresponding data in the parent table.");
    }
    /*
         * Build the thing
         */
    TableMetadata.Builder builder = TableMetadata.builder(keyspaceName, viewName);
    if (attrs.hasProperty(TableAttributes.ID))
        builder.id(attrs.getId());
    builder.params(attrs.asNewTableParams()).kind(TableMetadata.Kind.VIEW);
    partitionKeyColumns.forEach(name -> builder.addPartitionKeyColumn(name, getType(table, name)));
    clusteringColumns.forEach(name -> builder.addClusteringColumn(name, getType(table, name)));
    selectedColumns.stream().filter(name -> !primaryKeyColumns.contains(name)).forEach(name -> builder.addRegularColumn(name, getType(table, name)));
    ViewMetadata view = new ViewMetadata(table.id, table.name, rawColumns.isEmpty(), whereClause, builder.build());
    view.metadata.validate();
    return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.views.with(view)));
}
Also used : AuditLogContext(org.apache.cassandra.audit.AuditLogContext) Change(org.apache.cassandra.transport.Event.SchemaChange.Change) java.util(java.util) Iterables(com.google.common.collect.Iterables) Iterables.transform(com.google.common.collect.Iterables.transform) Permission(org.apache.cassandra.auth.Permission) AbstractType(org.apache.cassandra.db.marshal.AbstractType) org.apache.cassandra.cql3(org.apache.cassandra.cql3) AlreadyExistsException(org.apache.cassandra.exceptions.AlreadyExistsException) View(org.apache.cassandra.db.view.View) Guardrails(org.apache.cassandra.db.guardrails.Guardrails) Lists(com.google.common.collect.Lists) String.join(java.lang.String.join) Iterables.concat(com.google.common.collect.Iterables.concat) KeyspacesDiff(org.apache.cassandra.schema.Keyspaces.KeyspacesDiff) DatabaseDescriptor(org.apache.cassandra.config.DatabaseDescriptor) InvalidRequestException(org.apache.cassandra.exceptions.InvalidRequestException) ImmutableSet(com.google.common.collect.ImmutableSet) SchemaChange(org.apache.cassandra.transport.Event.SchemaChange) ClientState(org.apache.cassandra.service.ClientState) StatementRestrictions(org.apache.cassandra.cql3.restrictions.StatementRestrictions) AuditLogEntryType(org.apache.cassandra.audit.AuditLogEntryType) StatementType(org.apache.cassandra.cql3.statements.StatementType) Selectable(org.apache.cassandra.cql3.selection.Selectable) ReversedType(org.apache.cassandra.db.marshal.ReversedType) Target(org.apache.cassandra.transport.Event.SchemaChange.Target) RawSelector(org.apache.cassandra.cql3.selection.RawSelector) Iterables.filter(com.google.common.collect.Iterables.filter) org.apache.cassandra.schema(org.apache.cassandra.schema) AlreadyExistsException(org.apache.cassandra.exceptions.AlreadyExistsException) InvalidRequestException(org.apache.cassandra.exceptions.InvalidRequestException) StatementRestrictions(org.apache.cassandra.cql3.restrictions.StatementRestrictions)

Example 28 with Type

use of org.apache.cassandra.cql3.statements.schema.IndexTarget.Type in project cassandra by apache.

the class DropTypeStatement method apply.

// TODO: expand types into tuples in all dropped columns of all tables
public Keyspaces apply(Keyspaces schema) {
    ByteBuffer name = bytes(typeName);
    KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
    UserType type = null == keyspace ? null : keyspace.types.getNullable(name);
    if (null == type) {
        if (ifExists)
            return schema;
        throw ire("Type '%s.%s' doesn't exist", keyspaceName, typeName);
    }
    /*
         * We don't want to drop a type unless it's not used anymore (mainly because
         * if someone drops a type and recreates one with the same name but different
         * definition with the previous name still in use, things can get messy).
         * We have three places to check:
         * 1) UDFs and UDAs using the type
         * 2) other user type that can nest the one we drop and
         * 3) existing tables referencing the type (maybe in a nested way).
         */
    Iterable<Function> functions = keyspace.functions.referencingUserType(name);
    if (!isEmpty(functions)) {
        throw ire("Cannot drop user type '%s.%s' as it is still used by functions %s", keyspaceName, typeName, join(", ", transform(functions, f -> f.name().toString())));
    }
    Iterable<UserType> types = keyspace.types.referencingUserType(name);
    if (!isEmpty(types)) {
        throw ire("Cannot drop user type '%s.%s' as it is still used by user types %s", keyspaceName, typeName, join(", ", transform(types, UserType::getNameAsString)));
    }
    Iterable<TableMetadata> tables = keyspace.tables.referencingUserType(name);
    if (!isEmpty(tables)) {
        throw ire("Cannot drop user type '%s.%s' as it is still used by tables %s", keyspaceName, typeName, join(", ", transform(tables, t -> t.name)));
    }
    return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.types.without(type)));
}
Also used : TableMetadata(org.apache.cassandra.schema.TableMetadata) Function(org.apache.cassandra.cql3.functions.Function) ByteBuffer(java.nio.ByteBuffer) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) UserType(org.apache.cassandra.db.marshal.UserType)

Example 29 with Type

use of org.apache.cassandra.cql3.statements.schema.IndexTarget.Type in project cassandra by apache.

the class CreateTypeStatement method apply.

public Keyspaces apply(Keyspaces schema) {
    KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
    if (null == keyspace)
        throw ire("Keyspace '%s' doesn't exist", keyspaceName);
    UserType existingType = keyspace.types.getNullable(bytes(typeName));
    if (null != existingType) {
        if (ifNotExists)
            return schema;
        throw ire("A user type with name '%s' already exists", typeName);
    }
    Set<FieldIdentifier> usedNames = new HashSet<>();
    for (FieldIdentifier name : fieldNames) if (!usedNames.add(name))
        throw ire("Duplicate field name '%s' in type '%s'", name, typeName);
    for (CQL3Type.Raw type : rawFieldTypes) {
        if (type.isCounter())
            throw ire("A user type cannot contain counters");
        if (type.isUDT() && !type.isFrozen())
            throw ire("A user type cannot contain non-frozen UDTs");
    }
    List<AbstractType<?>> fieldTypes = rawFieldTypes.stream().map(t -> t.prepare(keyspaceName, keyspace.types).getType()).collect(toList());
    UserType udt = new UserType(keyspaceName, bytes(typeName), fieldNames, fieldTypes, true);
    return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.types.with(udt)));
}
Also used : AuditLogContext(org.apache.cassandra.audit.AuditLogContext) Change(org.apache.cassandra.transport.Event.SchemaChange.Change) java.util(java.util) Keyspaces(org.apache.cassandra.schema.Keyspaces) SchemaChange(org.apache.cassandra.transport.Event.SchemaChange) Permission(org.apache.cassandra.auth.Permission) ClientState(org.apache.cassandra.service.ClientState) CQLStatement(org.apache.cassandra.cql3.CQLStatement) FieldIdentifier(org.apache.cassandra.cql3.FieldIdentifier) ByteBufferUtil.bytes(org.apache.cassandra.utils.ByteBufferUtil.bytes) AbstractType(org.apache.cassandra.db.marshal.AbstractType) AuditLogEntryType(org.apache.cassandra.audit.AuditLogEntryType) Collectors.toList(java.util.stream.Collectors.toList) CQL3Type(org.apache.cassandra.cql3.CQL3Type) Target(org.apache.cassandra.transport.Event.SchemaChange.Target) Types(org.apache.cassandra.schema.Types) UTName(org.apache.cassandra.cql3.UTName) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) KeyspacesDiff(org.apache.cassandra.schema.Keyspaces.KeyspacesDiff) UserType(org.apache.cassandra.db.marshal.UserType) CQL3Type(org.apache.cassandra.cql3.CQL3Type) AbstractType(org.apache.cassandra.db.marshal.AbstractType) FieldIdentifier(org.apache.cassandra.cql3.FieldIdentifier) KeyspaceMetadata(org.apache.cassandra.schema.KeyspaceMetadata) UserType(org.apache.cassandra.db.marshal.UserType)

Example 30 with Type

use of org.apache.cassandra.cql3.statements.schema.IndexTarget.Type in project cassandra by apache.

the class DropAggregateStatement method apply.

public Keyspaces apply(Keyspaces schema) {
    String name = argumentsSpeficied ? format("%s.%s(%s)", keyspaceName, aggregateName, join(", ", transform(arguments, CQL3Type.Raw::toString))) : format("%s.%s", keyspaceName, aggregateName);
    KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
    if (null == keyspace) {
        if (ifExists)
            return schema;
        throw ire("Aggregate '%s' doesn't exist", name);
    }
    Collection<Function> aggregates = keyspace.functions.get(new FunctionName(keyspaceName, aggregateName));
    if (aggregates.size() > 1 && !argumentsSpeficied) {
        throw ire("'DROP AGGREGATE %s' matches multiple function definitions; " + "specify the argument types by issuing a statement like " + "'DROP AGGREGATE %s (type, type, ...)'. You can use cqlsh " + "'DESCRIBE AGGREGATE %s' command to find all overloads", aggregateName, aggregateName, aggregateName);
    }
    arguments.stream().filter(raw -> !raw.isTuple() && raw.isFrozen()).findFirst().ifPresent(t -> {
        throw ire("Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'", t, t);
    });
    List<AbstractType<?>> argumentTypes = prepareArgumentTypes(keyspace.types);
    Predicate<Function> filter = Functions.Filter.UDA;
    if (argumentsSpeficied)
        filter = filter.and(f -> Functions.typesMatch(f.argTypes(), argumentTypes));
    Function aggregate = aggregates.stream().filter(filter).findAny().orElse(null);
    if (null == aggregate) {
        if (ifExists)
            return schema;
        throw ire("Aggregate '%s' doesn't exist", name);
    }
    return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.functions.without(aggregate)));
}
Also used : CQL3Type(org.apache.cassandra.cql3.CQL3Type) Function(org.apache.cassandra.cql3.functions.Function) FunctionName(org.apache.cassandra.cql3.functions.FunctionName) AbstractType(org.apache.cassandra.db.marshal.AbstractType)

Aggregations

CQL3Type (org.apache.cassandra.cql3.CQL3Type)14 ByteBuffer (java.nio.ByteBuffer)12 Test (org.junit.Test)12 AbstractType (org.apache.cassandra.db.marshal.AbstractType)11 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)10 ArrayList (java.util.ArrayList)9 List (java.util.List)8 ClientState (org.apache.cassandra.service.ClientState)8 ColumnIdentifier (org.apache.cassandra.cql3.ColumnIdentifier)7 ProtocolVersion (org.apache.cassandra.transport.ProtocolVersion)7 FunctionName (org.apache.cassandra.cql3.functions.FunctionName)6 InvalidRequestException (org.apache.cassandra.exceptions.InvalidRequestException)6 java.util (java.util)4 Collections (java.util.Collections)4 ChronicleQueue (net.openhft.chronicle.queue.ChronicleQueue)4 ExcerptTailer (net.openhft.chronicle.queue.ExcerptTailer)4 RollCycles (net.openhft.chronicle.queue.RollCycles)4 QueryOptions (org.apache.cassandra.cql3.QueryOptions)4 TableMetadata (org.apache.cassandra.schema.TableMetadata)4 Set (java.util.Set)3