cloud-fan commented on a change in pull request #27400: [SPARK-30671][SQL] 
emptyDataFrame should use a LocalRelation
URL: https://github.com/apache/spark/pull/27400#discussion_r373327838
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
 ##########
 @@ -274,9 +274,7 @@ class SparkSession private(
    * @since 2.0.0
    */
   @transient
-  lazy val emptyDataFrame: DataFrame = {
-    createDataFrame(sparkContext.emptyRDD[Row].setName("empty"), 
StructType(Nil))
-  }
+  lazy val emptyDataFrame: DataFrame = Dataset.ofRows(self, LocalRelation())
 
 Review comment:
   `Dataset.ofRows(self, LocalRelation())` looks simpler as I don't need to 
jump into another method when reading the code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to