You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/03/27 09:15:27 UTC
[PR] [SPARK-56256][PYTHON] Add emptyDataFrame API to SparkSession [spark]
zhengruifeng opened a new pull request, #55055:
URL: https://github.com/apache/spark/pull/55055
### What changes were proposed in this pull request?
Add a new `SparkSession.emptyDataFrame(schema)` API that creates an empty DataFrame with the specified schema.
### Why are the changes needed?
Creating an empty DataFrame with a given schema is a common operation, but currently requires calling `spark.createDataFrame([], schema)` which is not very intuitive. This new API provides a more readable and discoverable way to create empty DataFrames.
### Does this PR introduce _any_ user-facing change?
Yes. Adds a new public API `SparkSession.emptyDataFrame(schema: Union[StructType, str]) -> DataFrame`.
### How was this patch tested?
Added unit tests in `test_creation.py` covering both `StructType` and DDL string schema inputs. Tests are shared via the mixin and run for both classic and Spark Connect.
### Was this patch authored or co-authored using generative AI tooling?
Yes.
--
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-56256][PYTHON] Add emptyDataFrame API to SparkSession [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #55055: [SPARK-56256][PYTHON] Add emptyDataFrame API to SparkSession
URL: https://github.com/apache/spark/pull/55055
--
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-56256][PYTHON] Add emptyDataFrame API to SparkSession [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #55055:
URL: https://github.com/apache/spark/pull/55055#issuecomment-4154336658
thanks, merged to master
--
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-56256][PYTHON] Add emptyDataFrame API to SparkSession [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #55055:
URL: https://github.com/apache/spark/pull/55055#issuecomment-4156385528
Thank you, @zhengruifeng !
--
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