Repository navigation
[GH-2511][Python] Add to_sedonadb() for SedonaSpark to SedonaDB conversion - #2515
Conversation
|
@jiayuasu please check this out. |
jbampton
left a comment
There was a problem hiding this comment.
This PR is now marked as a draft.
Firstly your commit description is all messed up and not filled in correctly.
You also need a much better PR title that is more descriptive and you can edit that on the GitHub website there is a button for that.
And please don't mix different changes in one PR. For example you are editing the docs workflow YAML file and also adding Python code for another feature.
If you want your PRs to be reviewed and merged quickly you need to work harder and make it very easy for the committers
1cdc27d to
30add38
Compare
30add38 to
27e1614
Compare
|
@jbampton Sorry for the delay I have been occupied with other tasks I have now fixed this correctly by rebasing it on upstream/master and removing all unrelated changes. I have also cleaned up the Python code and updated the description to be much more descriptive. |
There was a problem hiding this comment.
Pull request overview
Adds a DataFrame.to_sedonadb(connection=None) extension to convert SedonaSpark DataFrames into SedonaDB DataFrames via Arrow/GeoArrow, and introduces a Python test suite validating the conversion flow with/without a provided connection.
Changes:
- Add
to_sedonadb()monkey-patched method onpyspark.sql.DataFrameinsedona.spark. - Implement SedonaDB import + connection creation logic and Arrow handoff via
dataframe_to_arrow(). - Add unit tests covering automatic connection creation and using an explicit connection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| python/sedona/spark/init.py | Adds to_sedonadb() extension method and wires it onto pyspark.sql.DataFrame. |
| python/tests/test_to_sedonadb.py | Adds unit tests for conversion behavior with mocked SedonaDB and Arrow export. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[P2] Correct the dependency installation command The missing-dependency error in Please recommend the project's declared pip install "apache-sedona[db]"This extra installs Verified locally: package resolution fails for |
Is this PR related to a ticket?
Yes, this resolves GH-2511.
Closes #2511.
What changes were proposed in this PR?
This PR adds a to_sedonadb(connection=None) extension method to the
pyspark.sql.DataFrame, enabling users to seamlessly convert a SedonaSpark DataFrame into a SedonaDB DataFrame using the GeoArrow format. The implementation supports passing a pre-existing connection or automatically creating one if not provided, while also providing a clearImportErrorifsedona-dbis not installed. By robustly leveraging the existingdataframe_to_arrow()utility, it ensures high-performance spatial data transfer between Spark-based big data workflows and specialized SedonaDB analytics.How was this patch tested?
This patch was verified locally with a new automated test suite in python/tests/test_to_sedonadb.py that covers both automatic and manual connection management scenarios.