title: Spark filter multiple group of rows to a single row
body: <p>I am trying to acheive the following,</p>
  
  <p>Lets say I have a dataframe with the following columns</p>
  
  <pre><code>id  | name  | alias
  -------------------
  1   | abc   | short
  1   | abc   | ailas-long-1
  1   | abc   | another-long-alias
  2   | xyz   | short_alias
  2   | xyz   | same_length
  3   | def   | alias_1
  </code></pre>
  
  <p>I want to groupby id and name and select the shorter alias,</p>
  
  <p>The output I am expecting is </p>
  
  <pre><code>id  | name  | alias
  -------------------
  1   | abc   | short
  2   | xyz   | short_alias
  3   | def   | alias_1
  </code></pre>
  
  <p>I can achevie this using window and row_number, is there anyother efficient method to get the same result. In general, the thrid column filter condition can be anything in this case its the length of the field.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thank you.</p>