title: Window function and conditional filters in PySpark
body: <p>Is there a way to conditionally apply filter to a window function in pyspark? For every group in <code>col1</code> I want to keep only rows that have <code>X</code> in <code>col2</code>. If a group doesn't have <code>X</code> in <code>col2</code> I want to keep all rows in that group.</p>
  
  <pre><code>+------+------+
  | col1 | col2 |
  +------+------+
  | A    |      |
  +------+------+
  | A    | X    |
  +------+------+
  | A    |      |
  +------+------+
  | B    |      |
  +------+------+
  | B    |      |
  +------+------+
  | B    |      |
  +------+------+
  </code></pre>