<commit_before>package com.twitter.storehaus.cassandra.cql

import com.datastax.driver.core.querybuilder.QueryBuilder
import com.twitter.concurrent.Spool
import com.twitter.storehaus.{IterableStore, QueryableStore, ReadableStore}
import com.twitter.storehaus.cassandra.cql.cascading.CassandraCascadingRowMatcher
import com.twitter.util.{Future, FuturePool, Throw, Return}
import java.util.concurrent.Executors

abstract class AbstractCQLCassandraStore[K, V] (poolSize: Int, columnFamily: CQLCassandraConfiguration.StoreColumnFamily) 
  extends QueryableStore[String, (K, V)] 
  with CassandraCascadingRowMatcher[K, V]
  with IterableStore[K, V] {

  val futurePool = FuturePool(Executors.newFixedThreadPool(poolSize))
  
  /**
   * takes a where condition-string (and where condition only) of a CQL query 
   * (...similar to but not equal to SQL) as parameters and executes a query from it. 
   */
  override def queryable: ReadableStore[String, Seq[(K, V)]] = new Object with ReadableStore[String, Seq[(K, V)]] {
    import scala.collection.JavaConverters._
    override def get(whereCondition: String): Future[Option[Seq[(K, V)]]] = futurePool {
      val qStart = QueryBuilder.select(getColumnNamesString).from(columnFamily.getPreparedNamed).getQueryString()
      val query = if((whereCondition eq null) || ("" == whereCondition)) qStart else s"$qStart WHERE $whereCondition"  
  	  val rSet = columnFamily.session.getSession.execute(query)
  	  if(rSet.isExhausted) None else {
  		Some(rSet.all().asScala.map(row => getKeyValueFromRow(row)))
  	  }
    }
  }
  
  /**
   * allows iteration over all (K, V) using a query against queryable
   */
  override def getAll: Future[Spool[(K, V)]] = queryable.get("").transform {
    case Throw(y) => Future.exception(y)
    case Return(x) => futurePool {
      val seq = x.getOrElse(Seq[(K, V)]())
      seq.foldRight(Spool.empty[(K, V)])((kv, spool) => (kv) **:: spool)
    }
  }
}<commit_msg>fixed queryable column names in select<commit_after>package com.twitter.storehaus.cassandra.cql

import com.datastax.driver.core.querybuilder.QueryBuilder
import com.twitter.concurrent.Spool
import com.twitter.storehaus.{IterableStore, QueryableStore, ReadableStore}
import com.twitter.storehaus.cassandra.cql.cascading.CassandraCascadingRowMatcher
import com.twitter.util.{Future, FuturePool, Throw, Return}
import java.util.concurrent.Executors

abstract class AbstractCQLCassandraStore[K, V] (poolSize: Int, columnFamily: CQLCassandraConfiguration.StoreColumnFamily) 
  extends QueryableStore[String, (K, V)] 
  with CassandraCascadingRowMatcher[K, V]
  with IterableStore[K, V] {

  val futurePool = FuturePool(Executors.newFixedThreadPool(poolSize))
  
  /**
   * takes a where condition-string (and where condition only) of a CQL query 
   * (...similar to but not equal to SQL) as parameters and executes a query from it. 
   */
  override def queryable: ReadableStore[String, Seq[(K, V)]] = new Object with ReadableStore[String, Seq[(K, V)]] {
    import scala.collection.JavaConverters._
    override def get(whereCondition: String): Future[Option[Seq[(K, V)]]] = futurePool {
      val qStart = QueryBuilder.select(getColumnNamesString.split(","): _*).from(columnFamily.getPreparedNamed).getQueryString()
      val query = if((whereCondition eq null) || ("" == whereCondition)) qStart else s"$qStart WHERE $whereCondition"  
  	  val rSet = columnFamily.session.getSession.execute(query)
  	  if(rSet.isExhausted) None else {
  		Some(rSet.all().asScala.map(row => getKeyValueFromRow(row)))
  	  }
    }
  }
  
  /**
   * allows iteration over all (K, V) using a query against queryable
   */
  override def getAll: Future[Spool[(K, V)]] = queryable.get("").transform {
    case Throw(y) => Future.exception(y)
    case Return(x) => futurePool {
      val seq = x.getOrElse(Seq[(K, V)]())
      seq.foldRight(Spool.empty[(K, V)])((kv, spool) => (kv) **:: spool)
    }
  }
}
{'fraction_non_alphanumeric': 0.12786551197147222, 'fraction_numerical': 0.0, 'mean_word_length': 4.530985915492958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7493247', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1261, 'n_words': 290}