SedonaContext
Entry point for using Sedona from PySpark.
SedonaContext.builder returns a SparkSession builder configured with
Sedona’s Kryo serializer, and SedonaContext.create registers Sedona’s
spatial types, functions and optimizations on a SparkSession.
Examples
builder()
This method adds the basic Sedona configuration to the SparkSession builder.
Usually the user does not need to call this method directly, as it is configured when a cluster is created.
This method is needed when the user wants to manually configure Sedona
On Spark 4.2+, this builder appends Wherobots’ native spatial codec
plugin at session creation, preserving both platform and explicitly
configured spark.plugins.defaultList entries. Additional plugins may
be supplied independently with spark.plugins.
This applies to Classic sessions and locally started Connect servers.
Calling this builder for an existing SparkContext does not install a plugin
into that running context. External Spark contexts and Connect servers must
configure the codec plugin before startup.
:return: SparkSession.builder
create()
This is the core of whole package, It uses py4j to run wrapper which takes existing SparkSession
and register the core logics of Apache Sedona, for this SparkSession.
Parameters
pyspark.sql.SparkSession, spark session instance
Returns
SedonaContext which is an instance of SparkSession