title: Enforcing an interface on a DataFrame
body: <p>I'm new to Spark and was wondering if the following is possible.</p>
  
  <p>I have 2 <code>Datasets</code>, and they both have fields <code>EventTime</code> and <code>UserId</code>. However, they differ in all other columns.</p>
  
  <p>I want to write a function that takes in these <code>Datasets</code> and spits out the last time I saw each user.</p>
  
  <p>This is easy enough, because we can select the row with the maximum time for each user (<code>groupby</code>)</p>
  
  <p>Let's say I have a function <code>LastSeenTime(events: DataFrame): DataFrame { ... }</code></p>
  
  <p>My question is how would you organize the code, and potentially define a type/interface such that <code>LastSeenTime</code> can enforce that <code>events</code> has the <code>UserId</code> and <code>EventTime</code> columns it needs to do the processing.</p>
  
  <p>Can Dataset Schema's conform to partial interfaces?</p>
  
  <p>Thanks!</p>