一键导入
spark-best-practices
General Apache Spark best practices for scalable, maintainable, and performant DataFrame jobs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
General Apache Spark best practices for scalable, maintainable, and performant DataFrame jobs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | spark-best-practices |
| description | General Apache Spark best practices for scalable, maintainable, and performant DataFrame jobs. |
Use this skill for general Apache Spark guidance when optimizing performance, reliability, and maintainability.
collect(), toPandas(), and large take() in core data paths.coalesce when reducing output partitions.explain() and execution metrics/logs to inspect physical plans and shuffle boundaries.Every Structured Streaming query needs a stable checkpoint location. The checkpoint stores progress metadata and, for stateful queries such as windows, state-store data that Spark needs to recover correctly.
Use shared storage for cluster runs, not local /tmp, because executors must be
able to see the same checkpoint path.
oleander provides spark.oleander.app.state.dir as a shared application state
directory that users can use for streaming checkpoints.
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, count, window
spark = SparkSession.builder.appName("message-counts").getOrCreate()
state_dir = spark.conf.get("spark.oleander.app.state.dir", "").strip()
checkpoint = f"{state_dir.rstrip('/')}/public-stream/checkpoints/message-counts"
events = (
spark.readStream.format("kafka")
.option("kafka.bootstrap.servers", "localhost:9092")
.option("subscribe", "messages")
.load()
)
counts = (
events.selectExpr("CAST(value AS STRING) AS body", "timestamp AS event_time")
.withWatermark("event_time", "1 minute")
.groupBy(window(col("event_time"), "1 minute"))
.agg(count("*").alias("message_count"))
)
query = (
counts.writeStream
.format("console")
.outputMode("append")
.option("checkpointLocation", checkpoint)
.start()
)
query.awaitTermination()
Use lake-query to explore your data; compare seasonal revenue, analyze product changes, count new user signups, or find whatever answers are hidden in your data.
How to submit, monitor, and configure Spark jobs on oleander using MCP, the CLI, and the TypeScript SDK.
Run Polars queries or scripts on oleander, locally or distributed, and save results to the lake catalog.
Engine-agnostic guidance for working with the oleander lake catalog, including naming conventions, catalog hierarchy, and table reference patterns.
Spark-specific patterns for reading and writing oleander lake catalog tables, including append vs overwrite, avoiding driver writes, and reusable table naming.
oleander-specific Spark guidance for connected OpenLineage, collect() pitfalls, and environment variable usage.