title: pyspark dynamic filtering
body: <p>Is it possible to dynamically filter dataframes?</p>
  
  <p>For example, if I have the below dictionary with variable number of key value pairs, how can I filter the dataframe dynamically?</p>
  
  <pre><code>x = {
  "date": "2018-10-01",
  "color": "red"
  }
  </code></pre>
  
  <p>I can do this</p>
  
  <pre><code>df.filter(df["date"] == x["date"] &amp; df["color"] == x["color"])
  </code></pre>
  
  <p>But dictionary can have variable number of key value pairs, like also "shape": "circle" so I'd have to add to filter. Or if dictionary only had one kvp, it should filter on that one column only. Is there a way to build filter dynamically based on dictionary?</p>
  
  <p>Thank you</p>