title: spark sql use createOrReplaceTempView not really compute the result?
body: <p>My code is like this:</p>
  
  <pre><code>dataFrame.createOrReplaceTempView("tableName1")
  //udf1 and udf2 will return a struct
  var dataFrame1 = sql("select udf1(a) as col1,udf2(a) as col2 from tableName1");
  dataFrame1.createOrReplaceTempView("tableName2")
  var dataFrame2 = sql("select col1.x,col1.y,col1.z,col2.x,col2.y,col2.z from tableName2");
  dataFrame2.write.parquet("path")
  </code></pre>
  
  <p>I see the physical plan in Spark UI is like this:</p>
  
  <pre><code>select udf1(a).x,udf1(a).y,udf1(a).z,udf2.x,udf2.y,udf2.z from tableName2
  </code></pre>
  
  <p>It seems like that the <code>udf1</code> and <code>udf2</code> will be invoked 3 times。
  What I really want is that <code>udf1</code> and <code>udf2</code> only compute once。
  Hope some can help me.</p>