src/java/org/apache/cassandra/thrift/ThriftConverter.java
/**
    *
    * @param column
    * @param chosenTime
    * @return thriftified version of the column valid at the chosenTime
    */
@param column
@param chosenTime
@return thriftified version of the column valid at the chosenTime
@param column @param chosenTime @return thriftified version of the column valid at the chosenTime
public static ChosenColumnResult selectChosenColumn(IColumn column, long chosenTime)
   {
       if (column instanceof org.apache.cassandra.db.SuperColumn) {
           List<Column> chosenSubcolumns = new ArrayList<Column>();
           Set<Long> pendingTransactions = new HashSet<Long>();
           for (IColumn subcolumn : column.getSubColumns()) {
               ChosenColumnResult ccr = selectChosenColumn(subcolumn, chosenTime);
               chosenSubcolumns.add(ccr.cosc.column);
               if (ccr.transactionIds != null) {
                   pendingTransactions.addAll(ccr.transactionIds);
               }
           }
           return new ChosenColumnResult(wrapInCOSC(new SuperColumn(column.name(), chosenSubcolumns)), pendingTransactions);
       } else {
           assert column instanceof org.apache.cassandra.db.Column;
           org.apache.cassandra.db.Column currentlyVisibleColumn = (org.apache.cassandra.db.Column) column;
           assert chosenTime < LamportClock.getVersion() : "Client can't chose a logical time in the future";
           if (logger.isTraceEnabled()) {
               if (column.previousVersions() != null) {
                   String previousVersions = new String();
                   for (IColumn oldColumn : column.previousVersions()) {
                       previousVersions += ", " + oldColumn.earliestValidTime() + "-";
                   }
                   previousVersions = "{" + previousVersions.substring(2) + "}";
                   logger.trace("picking chosenTime={} from previousVersons={}, current={}-", new Object[]{chosenTime, previousVersions, currentlyVisibleColumn.earliestValidTime()});
               } else {
                   logger.trace("picking chosenTime={} from previousVersons=[], current={}-", chosenTime, currentlyVisibleColumn.earliestValidTime());
               }
           }
           if (column.earliestValidTime() <= chosenTime) {
               Set<Long> pendingTransactionIds = findAndUpdatePendingTransactions((org.apache.cassandra.db.Column) column, chosenTime, currentlyVisibleColumn);
               return new ChosenColumnResult(thriftifyIColumn(column), pendingTransactionIds);
           } else {
               if (column.previousVersions() != null) {
                   for (IColumn oldColumn : column.previousVersions()) {
                       if (oldColumn.earliestValidTime() <= chosenTime) {
                           Set<Long> pendingTransactionIds =  findAndUpdatePendingTransactions((org.apache.cassandra.db.Column) oldColumn, chosenTime, currentlyVisibleColumn);
                           return new ChosenColumnResult(thriftifyIColumn(oldColumn), pendingTransactionIds);
                       }
                   }
               }
               return new ChosenColumnResult(markFirstRoundResultAsValid(currentlyVisibleColumn), new HashSet<Long>());
           }
       }
   }
public static ChosenColumnResult selectChosenColumn ( IColumn column , long chosenTime ) { if ( column instanceof org . apache . cassandra . db . SuperColumn ) { List < Column > chosenSubcolumns = new ArrayList < Column > ( ) ; Set < Long > pendingTransactions = new HashSet < Long > ( ) ; for ( IColumn subcolumn : column . getSubColumns ( ) ) { ChosenColumnResult ccr = selectChosenColumn ( subcolumn , chosenTime ) ; chosenSubcolumns . add ( ccr . cosc . column ) ; if ( ccr . transactionIds != null ) { pendingTransactions . addAll ( ccr . transactionIds ) ; } } return new ChosenColumnResult ( wrapInCOSC ( new SuperColumn ( column . name ( ) , chosenSubcolumns ) ) , pendingTransactions ) ; } else { assert column instanceof org . apache . cassandra . db . Column ; org . apache . cassandra . db . Column currentlyVisibleColumn = ( org . apache . cassandra . db . Column ) column ; assert chosenTime < LamportClock . getVersion ( ) : "Client can't chose a logical time in the future" ; if ( logger . isTraceEnabled ( ) ) { if ( column . previousVersions ( ) != null ) { String previousVersions = new String ( ) ; for ( IColumn oldColumn : column . previousVersions ( ) ) { previousVersions += ", " + oldColumn . earliestValidTime ( ) + "-" ; } previousVersions = "{" + previousVersions . substring ( 2 ) + "}" ; logger . trace ( "picking chosenTime={} from previousVersons={}, current={}-" , new Object [ ] { chosenTime , previousVersions , currentlyVisibleColumn . earliestValidTime ( ) } ) ; } else { logger . trace ( "picking chosenTime={} from previousVersons=[], current={}-" , chosenTime , currentlyVisibleColumn . earliestValidTime ( ) ) ; } } if ( column . earliestValidTime ( ) <= chosenTime ) { Set < Long > pendingTransactionIds = findAndUpdatePendingTransactions ( ( org . apache . cassandra . db . Column ) column , chosenTime , currentlyVisibleColumn ) ; return new ChosenColumnResult ( thriftifyIColumn ( column ) , pendingTransactionIds ) ; } else { if ( column . previousVersions ( ) != null ) { for ( IColumn oldColumn : column . previousVersions ( ) ) { if ( oldColumn . earliestValidTime ( ) <= chosenTime ) { Set < Long > pendingTransactionIds = findAndUpdatePendingTransactions ( ( org . apache . cassandra . db . Column ) oldColumn , chosenTime , currentlyVisibleColumn ) ; return new ChosenColumnResult ( thriftifyIColumn ( oldColumn ) , pendingTransactionIds ) ; } } } return new ChosenColumnResult ( markFirstRoundResultAsValid ( currentlyVisibleColumn ) , new HashSet < Long > ( ) ) ; } } }
@param column
 @param chosenTime
 @return thriftified version of the column valid at the chosenTime
@param column @param chosenTime @return thriftified version of the column valid at the chosenTime
// goes through column by most recent first // If no previous version matches, then the client's first round read value is valid