src/java/org/apache/cassandra/cli/CliClient.java
/**
     * Update column family definition attributes
     * @param statement - ANTLR tree representing current statement
     * @param cfDefToUpdate - column family definition to apply updates on
     * @return cfDef - updated column family definition
     */
Update column family definition attributes
@param statement - ANTLR tree representing current statement
@param cfDefToUpdate - column family definition to apply updates on
@return cfDef - updated column family definition
Update column family definition attributes @param statement - ANTLR tree representing current statement @param cfDefToUpdate - column family definition to apply updates on @return cfDef - updated column family definition
private CfDef updateCfDefAttributes(Tree statement, CfDef cfDefToUpdate)
    {
        CfDef cfDef = new CfDef(cfDefToUpdate);
        for (int i = 1; i < statement.getChildCount(); i += 2)
        {
            String currentArgument = statement.getChild(i).getText().toUpperCase();
            ColumnFamilyArgument mArgument = ColumnFamilyArgument.valueOf(currentArgument);
            String mValue = statement.getChild(i + 1).getText();
            switch(mArgument)
            {
            case COLUMN_TYPE:
                cfDef.setColumn_type(CliUtils.unescapeSQLString(mValue));
                break;
            case COMPARATOR:
                cfDef.setComparator_type(CliUtils.unescapeSQLString(mValue));
                break;
            case SUBCOMPARATOR:
                cfDef.setSubcomparator_type(CliUtils.unescapeSQLString(mValue));
                break;
            case COMMENT:
                cfDef.setComment(CliUtils.unescapeSQLString(mValue));
                break;
            case READ_REPAIR_CHANCE:
                double chance = Double.parseDouble(mValue);
                if (chance < 0 || chance > 1)
                    throw new RuntimeException("Error: read_repair_chance must be between 0 and 1.");
                cfDef.setRead_repair_chance(chance);
                break;
            case GC_GRACE:
                cfDef.setGc_grace_seconds(Integer.parseInt(mValue));
                break;
            case COLUMN_METADATA:
                Tree arrayOfMetaAttributes = statement.getChild(i + 1);
                if (!arrayOfMetaAttributes.getText().equals("ARRAY"))
                    throw new RuntimeException("'column_metadata' format - [{ k:v, k:v, ..}, { ... }, ...]");
                cfDef.setColumn_metadata(getCFColumnMetaFromTree(cfDef, arrayOfMetaAttributes));
                break;
            case MEMTABLE_OPERATIONS:
                break;
            case MEMTABLE_THROUGHPUT:
                break;
            case DEFAULT_VALIDATION_CLASS:
                cfDef.setDefault_validation_class(CliUtils.unescapeSQLString(mValue));
                break;
            case MIN_COMPACTION_THRESHOLD:
                cfDef.setMin_compaction_threshold(Integer.parseInt(mValue));
                break;
            case MAX_COMPACTION_THRESHOLD:
                cfDef.setMax_compaction_threshold(Integer.parseInt(mValue));
                break;
            case REPLICATE_ON_WRITE:
                cfDef.setReplicate_on_write(Boolean.parseBoolean(mValue));
                break;
            case KEY_VALIDATION_CLASS:
                cfDef.setKey_validation_class(CliUtils.unescapeSQLString(mValue));
                break;
            case COMPACTION_STRATEGY:
                cfDef.setCompaction_strategy(CliUtils.unescapeSQLString(mValue));
                break;
            case COMPACTION_STRATEGY_OPTIONS:
                cfDef.setCompaction_strategy_options(getStrategyOptionsFromTree(statement.getChild(i+1)));
                break;
            case COMPRESSION_OPTIONS:
                cfDef.setCompression_options(getStrategyOptionsFromTree(statement.getChild(i+1)));
                break;
            case BLOOM_FILTER_FP_CHANCE:
                cfDef.setBloom_filter_fp_chance(Double.parseDouble(mValue));
                break;
            case CACHING:
                cfDef.setCaching(CliUtils.unescapeSQLString(mValue));
                break;
            default:
                assert(false);
            }
        }
        return cfDef;
    }
private CfDef updateCfDefAttributes ( Tree statement , CfDef cfDefToUpdate ) { CfDef cfDef = new CfDef ( cfDefToUpdate ) ; for ( int i = 1 ; i < statement . getChildCount ( ) ; i += 2 ) { String currentArgument = statement . getChild ( i ) . getText ( ) . toUpperCase ( ) ; ColumnFamilyArgument mArgument = ColumnFamilyArgument . valueOf ( currentArgument ) ; String mValue = statement . getChild ( i + 1 ) . getText ( ) ; switch ( mArgument ) { case COLUMN_TYPE : cfDef . setColumn_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPARATOR : cfDef . setComparator_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case SUBCOMPARATOR : cfDef . setSubcomparator_type ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMMENT : cfDef . setComment ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case READ_REPAIR_CHANCE : double chance = Double . parseDouble ( mValue ) ; if ( chance < 0 || chance > 1 ) throw new RuntimeException ( "Error: read_repair_chance must be between 0 and 1." ) ; cfDef . setRead_repair_chance ( chance ) ; break ; case GC_GRACE : cfDef . setGc_grace_seconds ( Integer . parseInt ( mValue ) ) ; break ; case COLUMN_METADATA : Tree arrayOfMetaAttributes = statement . getChild ( i + 1 ) ; if ( ! arrayOfMetaAttributes . getText ( ) . equals ( "ARRAY" ) ) throw new RuntimeException ( "'column_metadata' format - [{ k:v, k:v, ..}, { ... }, ...]" ) ; cfDef . setColumn_metadata ( getCFColumnMetaFromTree ( cfDef , arrayOfMetaAttributes ) ) ; break ; case MEMTABLE_OPERATIONS : break ; case MEMTABLE_THROUGHPUT : break ; case DEFAULT_VALIDATION_CLASS : cfDef . setDefault_validation_class ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case MIN_COMPACTION_THRESHOLD : cfDef . setMin_compaction_threshold ( Integer . parseInt ( mValue ) ) ; break ; case MAX_COMPACTION_THRESHOLD : cfDef . setMax_compaction_threshold ( Integer . parseInt ( mValue ) ) ; break ; case REPLICATE_ON_WRITE : cfDef . setReplicate_on_write ( Boolean . parseBoolean ( mValue ) ) ; break ; case KEY_VALIDATION_CLASS : cfDef . setKey_validation_class ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPACTION_STRATEGY : cfDef . setCompaction_strategy ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; case COMPACTION_STRATEGY_OPTIONS : cfDef . setCompaction_strategy_options ( getStrategyOptionsFromTree ( statement . getChild ( i + 1 ) ) ) ; break ; case COMPRESSION_OPTIONS : cfDef . setCompression_options ( getStrategyOptionsFromTree ( statement . getChild ( i + 1 ) ) ) ; break ; case BLOOM_FILTER_FP_CHANCE : cfDef . setBloom_filter_fp_chance ( Double . parseDouble ( mValue ) ) ; break ; case CACHING : cfDef . setCaching ( CliUtils . unescapeSQLString ( mValue ) ) ; break ; default : assert ( false ) ; } } return cfDef ; }
Update column family definition attributes
 @param statement - ANTLR tree representing current statement
 @param cfDefToUpdate - column family definition to apply updates on
 @return cfDef - updated column family definition
Update column family definition attributes @param statement - ANTLR tree representing current statement @param cfDefToUpdate - column family definition to apply updates on @return cfDef - updated column family definition
//must match one of the above or we'd throw an exception at the valueOf statement above.