Apache Spark SQL
$ spark-sql Foundation High Riskspark-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.
brew install apache-spark spark-sql launches Spark executors directly against local or distributed Parquet/Iceberg lakes; MCP cannot replace Spark's execution engine.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
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--jsonoutput flag and heavy JVM log noise
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-onlyor--dry-runflag
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
Unmatched for querying massive Parquet, Iceberg, and Delta datasets using standard Spark SQL.
- Full Spark SQL catalyst engine over local or cluster data lakes
Flagship Apache Software Foundation project (apache/spark) under Apache-2.0.
- Official Apache Spark repository
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
Reads spark-defaults.conf, hive-site.xml, and Hadoop/AWS env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, SPARK_CONF_DIR).
Apache-2.0 open-source CLI; cluster execution and cloud object storage scans incur compute/storage costs.
# 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
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.
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.
- +
-Sand--conf spark.ui.enabled=falsereduce noise for scripted invocations.
Caveats & Pitfalls
- ! Multi-second JVM/SparkContext startup per invocation and no native
--jsonoutput flag. - ! Default
log4j2INFO logging frequently pollutes stdout/stderr unless configured.