Package org.apache.cassandra.cql3

Examples of org.apache.cassandra.cql3.CFDefinition$NonCompositeBuilder


                String keyAliases = ByteBufferUtil.string(cqlRow.columns.get(5).value);
                keys = FBUtilities.fromJsonList(keyAliases);
                // classis thrift tables
                if (keys.size() == 0 && cqlRow.columns.get(6).value == null)
                {
                    CFDefinition cfDefinition = getCfDefinition(keyspace, column_family, client);
                    for (ColumnIdentifier column : cfDefinition.keys.keySet())
                    {
                        String key = column.toString();
                        String type = cfDefinition.keys.get(column).type.toString();
                        logger.debug("name: {}, type: {} ", key, type);
View Full Code Here


    }

    public void validateFields(CFMetaData metadata) throws MarshalException
    {
        validateName(metadata);
        CFDefinition cfdef = metadata.getCfDef();

        // If this is a CQL table, we need to pull out the CQL column name to look up the correct column type.
        // (Note that COMPACT composites are handled by validateName, above.)
        ByteBuffer internalName = (cfdef.isComposite && !cfdef.isCompact)
                                ? ((CompositeType) metadata.comparator).extractLastComponent(name)
View Full Code Here

         * object (partitionKeyColumns, ...) and the one stored in CFDefinition.
         * Ultimately, we should probably merge both. However, there is enough details to fix that
         * it's worth doing that in a separate issue.
         */
        rebuildCQL3Metadata();
        cqlCfDef = new CFDefinition(this);
        return this;
    }
View Full Code Here

                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
            if (metadata.cfType == ColumnFamilyType.Standard)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
        }
        AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, superColumnName);
        CFDefinition cfDef = metadata.getCfDef();
        boolean isCQL3Table = cfDef.isComposite && !cfDef.isCompact && !metadata.isSuper();
        for (ByteBuffer name : column_names)
        {
            if (name.remaining() > maxNameLength)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + maxNameLength);
View Full Code Here

        return column_metadata.remove(def.name) != null;
    }

    private CFMetaData updateCfDef()
    {
        cqlCfDef = new CFDefinition(this);
        return this;
    }
View Full Code Here

         * object (partitionKeyColumns, ...) and the one stored in CFDefinition.
         * Ultimately, we should probably merge both. However, there is enough details to fix that
         * it's worth doing that in a separate issue.
         */
        rebuildCQL3Metadata();
        cqlCfDef = new CFDefinition(this);
        return this;
    }
View Full Code Here

                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
            if (metadata.cfType == ColumnFamilyType.Standard)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
        }
        AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, superColumnName);
        CFDefinition cfDef = metadata.getCfDef();
        boolean isCQL3Table = cfDef.isComposite && !cfDef.isCompact && !metadata.isSuper();
        for (ByteBuffer name : column_names)
        {
            if (name.remaining() > maxNameLength)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + maxNameLength);
View Full Code Here

        return column_metadata.remove(def.name) != null;
    }

    private CFMetaData updateCfDef()
    {
        cqlCfDef = new CFDefinition(this);
        return this;
    }
View Full Code Here

        return column_metadata.remove(def.name) != null;
    }

    private CFMetaData updateCfDef()
    {
        cqlCfDef = new CFDefinition(this);
        return this;
    }
View Full Code Here

                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn name must not be empty");
            if (metadata.cfType == ColumnFamilyType.Standard)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("supercolumn specified to ColumnFamily " + metadata.cfName + " containing normal columns");
        }
        AbstractType<?> comparator = SuperColumns.getComparatorFor(metadata, superColumnName);
        CFDefinition cfDef = metadata.getCfDef();
        boolean isCQL3Table = !metadata.isThriftCompatible();
        for (ByteBuffer name : column_names)
        {
            if (name.remaining() > maxNameLength)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name length must not be greater than " + maxNameLength);
            if (name.remaining() == 0)
                throw new org.apache.cassandra.exceptions.InvalidRequestException("column name must not be empty");
            try
            {
                comparator.validate(name);
            }
            catch (MarshalException e)
            {
                throw new org.apache.cassandra.exceptions.InvalidRequestException(e.getMessage());
            }

            if (isCQL3Table)
            {
                // CQL3 table don't support having only part of their composite column names set
                CompositeType composite = (CompositeType)comparator;
                ByteBuffer[] components = composite.split(name);
                int minComponents = composite.types.size() - (cfDef.hasCollections ? 1 : 0);
                if (components.length < minComponents)
                    throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Not enough components (found %d but %d expected) for column name since %s is a CQL3 table",
                                                                                                    components.length, minComponents, metadata.cfName));

                // Furthermore, the column name must be a declared one.
                int columnIndex = composite.types.size() - (cfDef.hasCollections ? 2 : 1);
                ByteBuffer CQL3ColumnName = components[columnIndex];
                if (!CQL3ColumnName.hasRemaining())
                    continue; // Row marker, ok

                ColumnIdentifier columnId = new ColumnIdentifier(CQL3ColumnName, composite.types.get(columnIndex));
                CFDefinition.Name columnName = cfDef.get(columnId);
                if (columnName == null || columnName.isPrimaryKeyColumn())
                    throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("Invalid cell for CQL3 table %s. The CQL3 column component (%s) does not correspond to a defined CQL3 column",
                                                                                                    metadata.cfName, columnId));

                // On top of that, if we have a collection component, he (CQL3) column must be a collection
View Full Code Here

TOP

Related Classes of org.apache.cassandra.cql3.CFDefinition$NonCompositeBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.