public static List < ColumnDefinition > fromSchema ( UntypedResultSet serializedColumns , String ksName , String cfName , AbstractType < ? > rawComparator , boolean isSuper ) { List < ColumnDefinition > cds = new ArrayList <> ( ) ; for ( UntypedResultSet . Row row : serializedColumns ) { Kind kind = row . has ( KIND ) ? Kind . deserialize ( row . getString ( KIND ) ) : Kind . REGULAR ; Integer componentIndex = null ; if ( row . has ( COMPONENT_INDEX ) ) componentIndex = row . getInt ( COMPONENT_INDEX ) ; else if ( kind == Kind . CLUSTERING_COLUMN && isSuper ) componentIndex = 1 ; // A ColumnDefinition for super columns applies to the column component // Note: we save the column name as string, but we should not assume that it is an UTF8 name, we // we need to use the comparator fromString method AbstractType < ? > comparator = getComponentComparator ( rawComparator , componentIndex , kind ) ; ColumnIdentifier name = new ColumnIdentifier ( comparator . fromString ( row . getString ( COLUMN_NAME ) ) , comparator ) ; AbstractType < ? > validator ; try { validator = TypeParser . parse ( row . getString ( TYPE ) ) ; } catch ( RequestValidationException e ) { throw new RuntimeException ( e ) ; } IndexType indexType = null ; if ( row . has ( INDEX_TYPE ) ) indexType = IndexType . valueOf ( row . getString ( INDEX_TYPE ) ) ; Map < String , String > indexOptions = null ; if ( row . has ( INDEX_OPTIONS ) ) indexOptions = FBUtilities . fromJsonMap ( row . getString ( INDEX_OPTIONS ) ) ; String indexName = null ; if ( row . has ( INDEX_NAME ) ) indexName = row . getString ( INDEX_NAME ) ; cds . add ( new ColumnDefinition ( ksName , cfName , name , validator , indexType , indexOptions , indexName , componentIndex , kind ) ) ; } return cds ; }
Deserialize columns from storage - level representation