title: Spark internals: benefits of Project
body: <p>I've read <a href="https://stackoverflow.com/questions/59839910/rewrite-logicalplan-to-push-down-udf-from-aggregate">this question</a> in which the OP tried to convert this logical plan:</p>
  
  <pre><code>Aggregate [sum(inc(vals#4L)) AS sum(inc(vals))#7L]
  +- LocalRelation [vals#4L]
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>Aggregate [sum(inc_val#6L) AS sum(inc(vals))#7L]
  +- Project [inc(vals#4L) AS inc_val#6L]
     +- LocalRelation [vals#4L]
  </code></pre>
  
  <p>I have a couple of questions:</p>
  
  <ol>
  <li>Why did he want to have the Project operator? What is the advantage
  of it?</li>
  <li>As far as I know, Project is the operator that represents the SELECT statement,
  so how could possibly a plan not include a Project operator?</li>
  </ol>