title: How do you split PCollections by some criterion?
body: <p>How do you split a PCollection by some evaluation?</p>
  
  <p>Lets say I have:</p>
  
  <pre><code>  messages = (gcp | beam.io.ReadFromPubSub(topic=None, subscription=SUBSCRIPTION, with_attributes=True))
  </code></pre>
  
  <p>Now I want to split messages into two PCollections:</p>
  
  <pre><code>  split = messages | beam.Split(function())
  </code></pre>
  
  <p>split would be an array of PCollections, split by what is defined in my function.</p>
  
  <p>I cannot find anything that does this, except partition, but that seemingly just splits it into buckets arbitrarily, without having some function to determine what goes where.</p>