title: Using Idiomatic Scala in Spark
body: <p>I have the following expression,</p>
  
  <pre><code>val pageViews = spark.sql(
        s"""
           |SELECT
           |  proposal,
           |  MIN(timestamp) AS timestamp,
           |  MAX(page_view_after) AS page_view_after
           |FROM page_views
           |GROUP BY proposalId
           |""".stripMargin
      ).createOrReplaceTempView("page_views")
  </code></pre>
  
  <p>I want convert it into one that uses the Dataset API</p>
  
  <pre><code>val pageViews = pageViews.selectExpr("proposal", "MIN(timestamp) AS timestamp", "MAX(page_view_after) AS page_view_after").groupBy("proposal")
  </code></pre>
  
  <p>The problems is I can't call <code>createOrReplaceTempView</code> on this one - build fails.</p>
  
  <p>My question is how do I convert the first one into the second one and create a TempView out of that?</p>