title: Why Spark Cassandra connector allows filtering even when if query table by partitiong key using DataFrame API?
body: <p>Given Cassandra table:</p>
  
  <pre><code>CREATE TABLE data_storage.stack_overflow_test_table (
      id int,
      text_id text,
      clustering date,
      some_other text,
      PRIMARY KEY (( id, text_id ), clustering)
  )
  </code></pre>
  
  <p>the following query is a valid query:</p>
  
  <pre><code>select * from data_storage.test_table_filtering where id=4 and text_id='2';
  </code></pre>
  
  <p>Since I included all columns from partitioning key to query.</p>
  
  <p>Consider following code:</p>
  
  <pre><code>val ds = session.
    read
    .format("org.apache.spark.sql.cassandra")
    .options(Map("table" -&gt; "stack_overflow_test_table", "keyspace" -&gt; "data_storage"))
    .load()
    .where(col("id") === 4 &amp;&amp;
    col("text_id") === "2").show(10)
  </code></pre>
  
  <p>Since spark-cassandra connector pushes predicate to Cassandra, I expect query that Spark will send Cassandra be something like</p>
  
  <pre><code>SELECT "id", "text_id", "clustering", "some_other" FROM "data_storage"."stack_overflow_test_table" WHERE "id" = ? AND "text_id" = ? 
  </code></pre>
  
  <p>However, I can see in logs</p>
  
  <blockquote>
    <p>18/04/09 15:38:09 TRACE Connection: Connection[localhost/127.0.0.1:9042-2, inFlight=1, closed=false], stream 256, writing request PREPARE SELECT "id", "text_id", "clustering", "some_other" FROM "data_storage"."stack_overflow_test_table" WHERE "id" = ? AND "text_id" = ?   ALLOW FILTERING</p>
  </blockquote>
  
  <p><strong>That means spark-cassandra-connector adds ALLOW FILTERING to query</strong></p>
  
  <p>Therefore I have two questions:</p>
  
  <ol>
  <li>Does this affecting performance?</li>
  <li>Is there a workaround?</li>
  </ol>