You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "hvanhovell (via GitHub)" <gi...@apache.org> on 2025/12/16 18:21:05 UTC

[PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

hvanhovell opened a new pull request, #53489:
URL: https://github.com/apache/spark/pull/53489

   ### What changes were proposed in this pull request?
   This PR adds a version of `SparkSession.emptyDataFrame` that takes a schema.
   
   ### Why are the changes needed?
   It makes it easier to create an empty DataFrame in Scala. 
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, it adds a new API.
   
   ### How was this patch tested?
   I have added a test case.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.


-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

Posted by "asf-gitbox-commits (via GitHub)" <gi...@apache.org>.
asf-gitbox-commits closed pull request #53489: [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema
URL: https://github.com/apache/spark/pull/53489


-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

Posted by "hvanhovell (via GitHub)" <gi...@apache.org>.
hvanhovell commented on PR #53489:
URL: https://github.com/apache/spark/pull/53489#issuecomment-3675204997

   Merged to master. Thanks for the review.


-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

Posted by "hvanhovell (via GitHub)" <gi...@apache.org>.
hvanhovell commented on code in PR #53489:
URL: https://github.com/apache/spark/pull/53489#discussion_r2624431538


##########
sql/api/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -210,9 +210,15 @@ abstract class SparkSession extends Serializable with Closeable {
    *
    * @since 2.0.0
    */
-  @transient

Review Comment:
   It is not a val, so nothing is serialized. I think I accidentally left this when creating the interface.



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53489:
URL: https://github.com/apache/spark/pull/53489#discussion_r2624397351


##########
sql/api/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -210,9 +210,15 @@ abstract class SparkSession extends Serializable with Closeable {
    *
    * @since 2.0.0
    */
-  @transient
   def emptyDataFrame: DataFrame
 
+  /**
+   * Returns a `DataFrame` with schema `schema`and no rows.

Review Comment:
   super nit: a space
   ```suggestion
      * Returns a `DataFrame` with schema `schema` and no rows.
   ```



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-54720][SQL] Add SparkSession.emptyDataFrame with a schema [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #53489:
URL: https://github.com/apache/spark/pull/53489#discussion_r2624405116


##########
sql/api/src/main/scala/org/apache/spark/sql/SparkSession.scala:
##########
@@ -210,9 +210,15 @@ abstract class SparkSession extends Serializable with Closeable {
    *
    * @since 2.0.0
    */
-  @transient

Review Comment:
   interesting, so it has no effect for `def`?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org