Skip to main content

PySpark package for Catalyst logical plan capture with Base64 logging marker SPARK_LOGICAL_PLAN_CAPTURE_V2.

Project description

spark-logical-plan-capture-v2

PyPI-пакет для PySpark 3.5.x, который подключает Spark SQL extension:

  • перехватывает логические планы Catalyst
  • сериализует payload в Java binary form
  • кодирует payload в Base64
  • пишет маркер в лог: SPARK_LOGICAL_PLAN_CAPTURE_V2:<base64>

Installation

pip install spark-logical-plan-capture-v2

Usage

from pyspark.sql import SparkSession
from spark_logical_plan_capture import configure_spark_builder

builder = SparkSession.builder.appName("capture-demo").master("local[*]")
spark = configure_spark_builder(builder).getOrCreate()

spark.sql("select 1 as value").show()

Decode SQL from log line

from spark_logical_plan_capture import decode_captured_sql_from_logline

log_line = "SPARK_LOGICAL_PLAN_CAPTURE_V2:<base64>"
sql = decode_captured_sql_from_logline(spark, log_line)
print(sql)

Build and publish

  1. Соберите JVM jar:
sbt clean test package
  1. Скопируйте jar в Python package data:
python scripts/prepare_python_package.py
  1. Соберите wheel/sdist:
python -m build
  1. Опубликуйте:
python -m twine upload dist/*

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_logical_plan_capture_v2-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file spark_logical_plan_capture_v2-0.1.0.tar.gz.

File metadata

File hashes

Hashes for spark_logical_plan_capture_v2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 448134307e524cb4dd7fd43b6cae913f07b114e7edb6463ca646d1fdbffa7a37
MD5 03394902f3b13c97e3a390b408cbea87
BLAKE2b-256 2d820a354936a4e530cd655a59ee8ea2eda0d3c533a18ffbd9364af0fc1860e2

See more details on using hashes here.

File details

Details for the file spark_logical_plan_capture_v2-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spark_logical_plan_capture_v2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 347536a615da566ac3e9e305bdba6448345ebc2f34578ba2cafd5e59bbfdc048
MD5 97d5754e054279ee1db7295c5454ae2a
BLAKE2b-256 a58d17907d3d723aa476bb8e3b347f9f74556e24cb78be72eaff722d8a9f2a52

See more details on using hashes here.

Supported by

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