title: PySpark: select a column based on the condition another columns values match some specific values, then create the match result as a new column
body: <p>I ask the similarity <a href="https://stackoverflow.com/questions/62077780/hive-query-select-a-column-based-on-the-condition-another-columns-values-match">questions</a> before, but for some reasons, It is sad that I have to reimplement it in <code>PySpark</code>.<br>
  For example,</p>
  
  <pre><code>app      col1
  
  app1     anybody love me?
  app2     I hate u
  app3     this hat is good
  app4     I don't like this one
  app5     oh my god
  app6     damn you.
  app7     such nice girl
  app8     xxxxx
  app9     pretty prefect
  app10    don't love me.
  app11    xxx anybody?
  </code></pre>
  
  <p>I want to match a keyword list like <code>['anybody', 'love', 'you', 'xxx', 'don't']</code> and select the matched keyword result as a new column, named keyword as follows:</p>
  
  <pre><code>app      keyword
  
  app1     [anybody, love]
  app4     [don't]
  app6     [you]
  app8     [xxx]
  app10    [don't, love]
  app11    [xxx]
  </code></pre>
  
  <p>As the accepted answer the suitable way I can do is create a temporary dataframe which is converted by a string list then <code>inner join</code> these two dataframe together.<br>
  And <code>select</code> the rows of <code>app</code> and <code>keyword</code> that are matched in the condition.</p>
  
  <pre><code>-- Hiveql implementation
  select t.app, k.keyword
  from  mytable t
  inner join (values ('anybody'), ('you'), ('xxx'), ('don''t')) as k(keyword)
      on t.col1 like conca('%', k.keyword, '%')
  </code></pre>
  
  <p><br>
  But I am not familiar with <code>PySpark</code> and awkward to reimplement it. <br>
  Could anyone help me?<br>
  Thanks in advances.<br></p>