src/java/org/apache/cassandra/thrift/ThriftValidation.java
/**
     * Validates the data part of the column (everything in the Column object but the name, which is assumed to be valid)
     */
Validates the data part of the column (everything in the Column object but the name, which is assumed to be valid)
Validates the data part of the column ( everything in the Column object but the name which is assumed to be valid )
public static void validateColumnData(CFMetaData metadata, Column column, boolean isSubColumn) throws InvalidRequestException
    {
        validateTtl(column);
        if (!column.isSetValue())
            throw new InvalidRequestException("Column value is required");
        if (!column.isSetTimestamp())
            throw new InvalidRequestException("Column timestamp is required");
        ColumnDefinition columnDef = metadata.getColumnDefinition(column.name);
        try
        {
            AbstractType validator = metadata.getValueValidator(columnDef);
            if (validator != null)
                validator.validate(column.value);
        }
        catch (MarshalException me)
        {
            if (logger.isDebugEnabled())
                logger.debug("rejecting invalid value " + ByteBufferUtil.bytesToHex(summarize(column.value)));
            throw new InvalidRequestException(String.format("(%s) [%s][%s][%s] failed validation",
                                                            me.getMessage(),
                                                            metadata.ksName,
                                                            metadata.cfName,
                                                            (isSubColumn ? metadata.subcolumnComparator : metadata.comparator).getString(column.name)));
        }
        if (columnDef != null && columnDef.getIndexType() != null && column.value.remaining() > FBUtilities.MAX_UNSIGNED_SHORT)
            throw new InvalidRequestException(String.format("Can't index column value of size %d for index %s in CF %s of KS %s",
                                                            column.value.remaining(),
                                                            columnDef.getIndexName(),
                                                            metadata.cfName,
                                                            metadata.ksName));
    }
public static void validateColumnData ( CFMetaData metadata , Column column , boolean isSubColumn ) throws InvalidRequestException { validateTtl ( column ) ; if ( ! column . isSetValue ( ) ) throw new InvalidRequestException ( "Column value is required" ) ; if ( ! column . isSetTimestamp ( ) ) throw new InvalidRequestException ( "Column timestamp is required" ) ; ColumnDefinition columnDef = metadata . getColumnDefinition ( column . name ) ; try { AbstractType validator = metadata . getValueValidator ( columnDef ) ; if ( validator != null ) validator . validate ( column . value ) ; } catch ( MarshalException me ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "rejecting invalid value " + ByteBufferUtil . bytesToHex ( summarize ( column . value ) ) ) ; throw new InvalidRequestException ( String . format ( "(%s) [%s][%s][%s] failed validation" , me . getMessage ( ) , metadata . ksName , metadata . cfName , ( isSubColumn ? metadata . subcolumnComparator : metadata . comparator ) . getString ( column . name ) ) ) ; } if ( columnDef != null && columnDef . getIndexType ( ) != null && column . value . remaining ( ) > FBUtilities . MAX_UNSIGNED_SHORT ) throw new InvalidRequestException ( String . format ( "Can't index column value of size %d for index %s in CF %s of KS %s" , column . value . remaining ( ) , columnDef . getIndexName ( ) , metadata . cfName , metadata . ksName ) ) ; }
Validates the data part of the column (everything in the Column object but the name, which is assumed to be valid)
Validates the data part of the column ( everything in the Column object but the name which is assumed to be valid )
// Indexed column values cannot be larger than 64K.  See CASSANDRA-3057 for more details