Skip to main content

No project description provided

Project description

congruity

In many ways, the migration from using classic Spark applications using the full power and flexibility to be using only the Spark Connect compatible DataFrame API can be challenging.

The goal of this library is to provide a compatibility layer that makes it easier to adopt Spark Connect. The library is designed to be simply imported in your application and will then monkey-patch the existing API to provide the legacy functionality.

Non-Goals

This library is not intended to be a long-term solution. The goal is to provide a compatibility layer that becomes obsolete over time. In addition, we do not aim to provide compatibility for all methods and features but only a select subset. Lastly, we do not aim to achieve the same performance as using some of the native RDD APIs.

Usage

Spark JVM & Spark Connect compatibility library.

pip install congruity
import congruity

Example

Here is code that works on Spark JVM:

import congruity  # noqa: F401
from pyspark.sql import SparkSession
spark = SparkSession.builder.remote("sc://localhost").getOrCreate()
data = [("Java", "20000"), ("Python", "100000"), ("Scala", "3000")]
spark.sparkContext.parallelize(data).toDF()

This code doesn't work with Spark Connect. The congruity library rearranges the code under the hood, so the old syntax works on Spark Connect clusters as well:

import congruity # noqa: F401
from pyspark.sql import SparkSession
spark = SparkSession.builder.remote("sc://localhost").getOrCreate()
data = [("Java", "20000"), ("Python", "100000"), ("Scala", "3000")]
spark.sparkContext.parallelize(data).toDF()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spark_congruity-0.0.1rc0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

spark_congruity-0.0.1rc0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file spark_congruity-0.0.1rc0.tar.gz.

File metadata

  • Download URL: spark_congruity-0.0.1rc0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for spark_congruity-0.0.1rc0.tar.gz
Algorithm Hash digest
SHA256 191aa8ed7b57df86c00025af32dc859a458acb86b156c772bf9cc3a79920362a
MD5 100e33d84c6f86da8aee162b8b656b1e
BLAKE2b-256 18dac613f0662084ef0c959d14dd6126617e215bb84a67545e948aa5d2c10a86

See more details on using hashes here.

File details

Details for the file spark_congruity-0.0.1rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for spark_congruity-0.0.1rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c7a1e65bd70e5c163b942503f7aa95b9440e6951d8287dd213fc5c13e90363f
MD5 e507369b5320a50ccefd2cb7b30a9024
BLAKE2b-256 5ae2b4ecf0d45d85cdbcf9526a091894cb7de9f2a56e433eeba3747e4629174a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page