← Back to Pull requests

feat: add datafusion-spark-cli, a SQL shell with the Spark functions #326

Closed
unknown closed this pull request without merging on Nov 23, 2026 17:09 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 13:04 UTC
Author

Which issue does this PR close?

Part of #56. It covers the datafusion-cli --spark references in the "Update the imported docs" item, since those READMEs now point to the new CLI.

Rationale for this change

apache/datafusion#27337 removed datafusion-cli --spark, which enabled the Spark SQL dialect and registered the Spark-compatible functions. Since then there is no way to try the functions interactively, and crates/spark/README.md and crates/sqllogictest/test_files/README.md still tell people to run datafusion-cli --spark.

What changes are included in this PR?

  • crates/cli, a new datafusion-spark-cli binary. It uses the datafusion-cli library for the REPL, for running files and commands, for output formats, and for querying files by path or URL (SELECT * FROM 'data.parquet'). Its main.rs is about 200 lines, following datafusion-cli's.

  • - Always Spark: the Spark SQL dialect and the Spark functions are always enabled. The Spark functions override DataFusion's functions of the same name.
    - ANSI mode on by default, as in Spark 4 (spark.sql.ansi.enabled = true). --ansi false gives Spark's legacy behavior. The startup banner says which mode is on.
    - Options kept from datafusion-cli: -c, -f, -r, -p, -b, --format, -q, --maxrows and --color. The memory and disk tuning options are left out for now.
  • Not published: publish = false.

  • Not a default workspace member: datafusion-cli brings in the object store and AWS dependencies, so a plain cargo build or cargo test at the root skips this crate. The clippy job uses --workspace, so it still lints the crate.

  • New workflow, .github/workflows/cli.yml. It builds the CLI and runs a smoke test:

  • - sha2 returns Spark's result.
    - abs(cast(-2147483648 AS int)) fails by default, because ANSI mode is on.
    - The same query returns -2147483648 with --ansi false.
  • Docs: crates/spark/README.md, test_files/README.md, the root README.md and AGENTS.md describe the new CLI.
  • datafusion-cli on DataFusion's branch-56 still depends on that branch's own datafusion-spark, so the build compiles that copy too. Only this repository's functions are registered. The extra copy goes away with DataFusion 57, where datafusion-cli no longer depends on datafusion-spark.

    Are these changes tested?

  • The smoke test's three queries pass locally.

  • I also tried the REPL reading from stdin, a backquoted identifier (Spark dialect), --help and the banner.

  • cargo clippy --all-targets --all-features --workspace -- -D warnings is clean.

  • cargo test -p datafusion-spark and cargo test -p datafusion-spark-sqllogictest still pass.

  • actionlint reports no problems with the new workflow.
  • Are there any user-facing changes?

    There is a new, unpublished datafusion-spark-cli binary. You run it with cargo run -p datafusion-spark-cli.

    _This PR was written by an LLM (Claude) and reviewed before opening._

    🤖 Generated with Claude Code

    Diff: 383 lines (+287 / -96) across 4 files Reviewer: kosiew Review duration: 10325m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 383 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #326"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.0% · Safe to merge
    17.0%