title: Cassandra - Hadoop (Pig) integration issue - Not able to filter on columns which are part of partition key
body: <p>Hello Cassandra users,</p>
  
  <p>For one of our our new Big data BI projects, we are using Apache Cassandra 1.2.10 as our primary data store with the support of Hadoop for analytics. For prototyping purpose we have 1 node each for Apache Cassandra/Hadoop. Pig is our choice to process the data from/to C*.</p>
  
  <p>Before coming to the actual problem, for one of the CFs, primary key is a composite one. Eg: ((A,B,C),D). Based on the documentation combination of (A,B,C) is our partition key.</p>
  
  <p>We are facing couple of issues with Pig talking to C*. Most important are;</p>
  
  <p><strong>Problem 1:</strong></p>
  
  <p><em>We are not able to apply filters on the columns which are part of partition key.</em> This seems to be very basic requirement to have for C*-Pig integration.</p>
  
  <p>Example:</p>
  
  <pre><code>CREATE table myCF(
    colA text,
    colB int,
    colC bigint,
    colD bigint,
  
    primary key ((colA, colB, colC), colD)
  )
  </code></pre>
  
  <p>Pig-Cassandra Query</p>
  
  <blockquote>
    <p>data = LOAD
    'cql://myKS/myCF?where_clause%3DcolA%3DsomeVal%20AND%20colB%3DsomeVal%20AND%20colC%3DsomeVal'
    USING CqlStorage();</p>
  </blockquote>
  
  <p>Exception</p>
  
  <blockquote>
    <p>InvalidRequestException(why:colA cannot be restricted by more than one
    relation if it includes an Equal)</p>
  </blockquote>
  
  <p>To give you more idea on the problem, here is the jira on the same topic.
  <a href="https://issues.apache.org/jira/browse/CASSANDRA-6151" rel="nofollow">https://issues.apache.org/jira/browse/CASSANDRA-6151</a></p>
  
  <p>Unfortunately the status of the issue is resolved with resolution as "Won't Fix". Not sure why.</p>
  
  <p>Because of this we are dead in the water. No clue how to proceed.</p>
  
  <p>Someone from community suggested to use filter using Pig. But that seems to be not a idea case as we load whole data from Cassandra and then applying filters before processing. isn't?</p>
  
  <p>As per my understanding, If we avoid using filter by partition key columns
  on Cassandra query then there will be scan for data across clusters.</p>
  
  <p><strong>Problem 2:</strong></p>
  
  <p>If there is filter just on a secondary index column, we get timeouts.</p>
  
  <p>Can anyone help me out to solve the above problems.</p>