title: Why does a traversal that filters on partition key need a full-table scan?
body: <p>I'm investigating a possible bug with partition scans using custom vertex IDs in DSE Graph.
  For some reason, selecting a vertex by its full ID works as expected, but retrieving the whole partition results in a full table scan (i.e. graph scan warning).</p>
  
  <p>Following this vertex label definition:
  <code>schema.vertexLabel('word_hoard').partitionKey('_partition').clusteringKey('wordhoard_id').create()</code></p>
  
  <p><code>g.V().hasLabel('word_hoard').has('_partition', 'localhost').has('wordhoard_id', '60bcaeff-f6e5-11e5-9ce9-00aaaaaaaaaa')</code></p>
  
  <p>leads to efficient CQL that makes sense:</p>
  
  <pre><code>SELECT * FROM topics_dev.word_hoard_p 
    WHERE "_partition" = 'localhost' AND wordhoard_id = 60bcaeff-f6e5-11e5-9ce9-00aaaaaaaaaa;
  </code></pre>
  
  <p><code>g.V().hasLabel('word_hoard').has('_partition', 'localhost')</code></p>
  
  <p>however, generates CQL that seems uninformed about the partition key:</p>
  
  <pre><code>SELECT "_partition", "wordhoard_id" FROM "topics_dev"."word_hoard_p"
    WHERE "~~vertex_exists" = true
  </code></pre>
  
  <p>To avoid this unnecessary table scan, I would expect something like:</p>
  
  <pre><code>SELECT * FROM topics_dev.word_hoard_p
    WHERE "_partition" = 'localhost';
  </code></pre>
  
  <p>This CQL query performs well, but I cannot seem to generate it with a gremlin traversal.</p>
  
  <p>Does anyone have experience with this issue?</p>
  
  <p>Should I approach it differently, or is this a genuine bug in DSE or tinkerpop?</p>
  
  <p>UPDATE 2018-10-30: this issue still exists as of DSE 6.0.4</p>
  
  <p>UPDATE 2019-10-19: a solution is available for testing in the DataStax Labs graph engine (experimental; non-production): <a href="https://community.datastax.com/answers/1150/view.html" rel="nofollow noreferrer">https://community.datastax.com/answers/1150/view.html</a></p>