This project provides extensions to the Apache Spark project in Scala and Python:
Diff: A diff transformation and application for Datasets that computes the differences between
two datasets, i.e. which rows to add, delete or change to get from one dataset to the other.
Histogram: A histogram transformation that computes the histogram DataFrame for a value column.
Global Row Number: A withRowNumbers transformation that provides the global row number w.r.t.
the current order of the Dataset, or any given order. In contrast to the existing SQL function row_number, which
requires a window spec, this transformation provides the row number across the entire Dataset without scaling problems.
Inspect Parquet files: The structure of Parquet files (the metadata, not the data stored in Parquet) can be inspected similar to parquet-tools
or parquet-cli by reading from a simple Spark data source.
This simplifies identifying why some Parquet files cannot be split by Spark into scalable partitions.
Spark temporary directory: Create a temporary directory that will be removed on Spark application shutdown.
Example:
# noinspection PyUnresolvedReferences
from gresearch.spark import *
dir = spark.create_temporary_dir("prefix")
Spark job description: Set Spark job description for all Spark jobs within a context.
Example:
from gresearch.spark import job_description, append_job_description
with job_description("parquet file"):
df = spark.read.parquet("data.parquet")
with append_job_description("count"):
count = df.count
with append_job_description("write"):
df.write.csv("data.csv")
For details, see the README.md at the project homepage.
Using Spark Extension
PyPi package (local Spark cluster only)
You may want to install the pyspark-extension python package from PyPi into your development environment.
This provides you code completion, typing and test capabilities during your development phase.
Running your Python application on a Spark cluster will still require one of the ways below
to add the Scala package to the Spark environment.
pip install pyspark-extension==2.15.1.3.4
Note: Pick the right Spark version (here 3.4) depending on your PySpark version.
PySpark API
Start a PySpark session with the Spark Extension dependency (version ≥1.1.0) as follows:
Apache Sedona is a cluster computing system for processing large-scale spatial data
1.2M downloads/mo
koalasPythie’s Index: 21Koalas: pandas API on Apache Spark464.7K downloads/mo
delta-sharingPythie’s Index: 84Python Connector for Delta Sharing966.5K downloads/mo
dbl-tempoPythie’s Index: 34Tempo is timeseries manipulation for Spark. This project builds upon the capabilities of PySpark to provide a suite of abstractions and functions that make operations on timeseries data easier and highly scalable.1.8M downloads/mo