Buggy code:
public String getColumnFamilyName ( ) { } private static String getColumnFamilyFromFileName ( String filename ) { } protected static int getIndexFromFileName ( String filename ) { } String getTempSSTablePath ( ) { } String getTempSSTableFileName ( ) { } void switchMemtable ( Memtable oldMemtable , CommitLog . CommitLogContext ctx ) { } void switchBinaryMemtable ( String key , byte [ ] buffer ) throws IOException { } public void forceFlush ( ) { } void forceBlockingFlush ( ) throws IOException , InterruptedException , ExecutionException { } public void forceFlushBinary ( ) { } void apply ( String key , ColumnFamily columnFamily , CommitLog . CommitLogContext cLogCtx ) throws IOException { } void applyBinary ( String key , byte [ ] buffer ) throws IOException { } private static void merge ( List < ColumnFamily > columnFamilies ) { } private static ColumnFamily resolveAndRemoveDeleted ( List < ColumnFamily > columnFamilies ) { } static ColumnFamily removeDeleted ( ColumnFamily cf ) { } public static int getDefaultGCBefore ( ) { } static ColumnFamily removeDeleted ( ColumnFamily cf , int gcBefore ) { } void applyNow ( String key , ColumnFamily columnFamily ) throws IOException { } void onMemtableFlush ( CommitLog . CommitLogContext cLogCtx ) throws IOException { } void storeLocation ( SSTableReader sstable ) { } private PriorityQueue < FileStruct > initializePriorityQueue ( List < String > files , List < Range > ranges ) throws IOException { } static Set < List < String > > getCompactionBuckets ( Iterable < String > files , long min ) { } int doCompaction ( int minThreshold , int maxThreshold ) throws IOException { } void doMajorCompaction ( long skip ) throws IOException { } void doMajorCompactionInternal ( long skip ) throws IOException { } long getExpectedCompactedFileSize ( List < String > files ) { } String getMaxSizeFile ( List < String > files ) { } boolean doAntiCompaction ( List < Range > ranges , EndPoint target , List < String > fileList ) throws IOException { } void forceCleanup ( ) { } void doCleanupCompaction ( ) throws IOException { } void doCleanup ( String file ) throws IOException { } boolean doFileAntiCompaction ( List < String > files , List < Range > ranges , EndPoint target , List < String > fileList ) throws IOException { } private int doFileCompaction ( List < String > files , int minBufferSize ) throws IOException { } public static List < Memtable > getUnflushedMemtables ( String cfName ) { } private static Set < Memtable > getMemtablesPendingFlushNotNull ( String columnFamilyName ) { } private static void submitFlush ( final Memtable memtable , final CommitLog . CommitLogContext cLogCtx ) { } static void submitFlush ( final BinaryMemtable binaryMemtable ) { } public boolean isSuper ( ) { } public void flushMemtableOnRecovery ( ) throws IOException { } public int getMemtableColumnsCount ( ) { } public int getMemtableDataSize ( ) { } public int getMemtableSwitchCount ( ) { } private Memtable getMemtableThreadSafe ( ) { } public Iterator < String > memtableKeyIterator ( ) throws InterruptedException , ExecutionException { } public Collection < SSTableReader > getSSTables ( ) { } public ReentrantReadWriteLock . ReadLock getReadLock ( ) { } public int getReadCount ( ) { } public double getReadLatency ( ) { } public int getPendingTasks ( ) { } public int getWriteCount ( ) { } public double getWriteLatency ( ) { } public ColumnFamily getColumnFamily ( String key , QueryPath path , byte [ ] start , byte [ ] finish , boolean reversed , int limit ) throws IOException { } public ColumnFamily getColumnFamily ( QueryFilter filter ) throws IOException { } public ColumnFamily getColumnFamily ( QueryFilter filter , int gcBefore ) throws IOException { assert columnFamily_ . equals ( filter . getColumnFamilyName ( ) ) ; long start = System . currentTimeMillis ( ) ; if ( ( filter . path . superColumnName ) != null ) { QueryFilter nameFilter = new NamesQueryFilter ( filter . key , new QueryPath ( columnFamily_ ) , filter . path . superColumnName ) ; ColumnFamily cf = getColumnFamily ( nameFilter ) ; <START_BUG> if ( cf == null ) <END_BUG> return cf ; assert ( cf . getSortedColumns ( ) . size ( ) ) == 1 ; SuperColumn sc = ( ( SuperColumn ) ( cf . getSortedColumns ( ) . iterator ( ) . next ( ) ) ) ; SuperColumn scFiltered = filter . filterSuperColumn ( sc , gcBefore ) ; ColumnFamily cfFiltered = cf . cloneMeShallow ( ) ; cfFiltered . addColumn ( scFiltered ) ; readStats_ . add ( ( ( System . currentTimeMillis ( ) ) - start ) ) ; return cfFiltered ; } sstableLock_ . readLock ( ) . lock ( ) ; List < ColumnIterator > iterators = new ArrayList < ColumnIterator > ( ) ; try { final ColumnFamily returnCF ; ColumnIterator iter ; memtableLock_ . readLock ( ) . lock ( ) ; try { iter = filter . getMemColumnIterator ( memtable_ , getComparator ( ) ) ; returnCF = iter . getColumnFamily ( ) ; } finally { memtableLock_ . readLock ( ) . unlock ( ) ; } iterators . add ( iter ) ; List < Memtable > memtables = ColumnFamilyStore . getUnflushedMemtables ( filter . getColumnFamilyName ( ) ) ; for ( Memtable memtable : memtables ) { iter = filter . getMemColumnIterator ( memtable , getComparator ( ) ) ; returnCF . delete ( iter . getColumnFamily ( ) ) ; iterators . add ( iter ) ; } List < SSTableReader > sstables = new ArrayList < SSTableReader > ( ssTables_ . values ( ) ) ; for ( SSTableReader sstable : sstables ) { iter = filter . getSSTableColumnIterator ( sstable ) ; if ( iter . hasNext ( ) ) { returnCF . delete ( iter . getColumnFamily ( ) ) ; }

Fix:
if ( ( cf == null ) || ( ( cf . getColumnCount ( ) ) == 0 ) )