Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Apache Spark SQL

$ spark-sql Foundation High Risk
Apache Software Foundation · Database & Data · Apache-2.0 · macos / linux / windows

spark-sql is the Hive-compatible CLI bundled with Apache Spark for running SQL across local Parquet/JSON files, Hive metastores, Iceberg, and Delta tables. While -e and -f run headlessly, heavy JVM startup and verbose Spark INFO logs require --conf tuning for clean agent parsing.

FCRS-1.0 Score
74 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
brew install apache-spark
CLI vs MCP Decision CLI Only

spark-sql launches Spark executors directly against local or distributed Parquet/Iceberg lakes; MCP cannot replace Spark's execution engine.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 16 / 25

Supports -e, -f, and -S silent mode, but emits tab-delimited text rather than --json and generates noisy Spark/Hadoop JVM logs unless log4j2 is tuned.

  • Supports -e, -f, and -S; no --json output flag and heavy JVM log noise
Trust & Safety 18 / 25

Supports EXPLAIN plan inspection and --conf tuning, though there is no --read-only or --dry-run flag and INSERT OVERWRITE can replace partitions.

  • Supports EXPLAIN; lacks --read-only or --dry-run flag
Setup & Portability 10 / 15

Available via brew install apache-spark and tarballs, requiring a compatible JDK/JVM and substantial memory footprint.

  • Requires JDK/JVM and multi-hundred-MB Spark distribution
Utility & Efficiency 14 / 15

Unmatched for querying massive Parquet, Iceberg, and Delta datasets using standard Spark SQL.

  • Full Spark SQL catalyst engine over local or cluster data lakes
Maintenance & Lineage 9 / 10

Flagship Apache Software Foundation project (apache/spark) under Apache-2.0.

  • Official Apache Spark repository
Docs & Verifiability 7 / 10

Documented in official Spark SQL CLI docs, though many tuning flags live across broader Spark config docs.

  • Official docs at spark.apache.org

Security, Auth & Guardrails

Auth Modes
Config File Env API Key No Auth
Credential Storage

Reads spark-defaults.conf, hive-site.xml, and Hadoop/AWS env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, SPARK_CONF_DIR).

Side Effects
Read-Only Local Write Remote Write Destructive Billing Impact
Cost & Quotas

Apache-2.0 open-source CLI; cluster execution and cloud object storage scans incur compute/storage costs.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Apache Spark SQL (spark-sql) Agent Rules
- Pass `-S` (`--silent`), `--conf spark.ui.enabled=false`, and `-e` / `-f` to suppress chatter and avoid REPL hangs.
- Run `EXPLAIN` and apply partition filters before scanning large data-lake tables.
- Never run `DROP TABLE` or `INSERT OVERWRITE` without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Query a local Parquet directory with local Spark
spark-sql --master 'local[2]' --conf spark.ui.enabled=false -S -e "SELECT count(*) FROM parquet.\`./events.parquet\`;"

Counts rows in a local Parquet dataset using silent -S mode with Spark Web UI disabled.

Inspect execution plan via EXPLAIN
spark-sql --master 'local[2]' -S -e "EXPLAIN SELECT * FROM events LIMIT 10;"

Prints the logical and physical Spark SQL execution plan before running heavy scans.

Strengths for Agents

  • + Queries Parquet, Iceberg, Delta, and Hive tables directly with full Spark SQL.
  • + -S and --conf spark.ui.enabled=false reduce noise for scripted invocations.

Caveats & Pitfalls

  • ! Multi-second JVM/SparkContext startup per invocation and no native --json output flag.
  • ! Default log4j2 INFO logging frequently pollutes stdout/stderr unless configured.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI