← Back to Pull requests

docs(spark): generate function reference from #[user_doc] #115

Closed
unknown closed this pull request without merging on Nov 19, 2026 15:25 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 17:30 UTC
Author

Part of #55

Rationale

The recent #[user_doc] PRs (#58, #103–#107) attach user documentation to most functions, but nothing in the repo renders it. cargo doc doesn't show it either, since #[user_doc] builds a runtime Documentation value rather than rustdoc, and those PRs cut the rustdoc down to a one-line summary. So the docs can't be read anywhere yet.

Changes

  • Add crates/docgen (datafusion-spark-docgen, publish = false) with a print_functions_docs binary. It is based on DataFusion's print_functions_docs. It writes Markdown for all scalar, aggregate and window functions returned by all_default_*_functions(), with arguments, examples, alternative syntax and aliases.

  • - Output goes to docs/functions, with one page per function type and doc section (for example scalar/math.md) and a README.md index. The index links each section with its function count, then lists every function and alias alphabetically. A single page was about 2,500 lines already and would reach roughly 10,000 with full Spark coverage.
    - Sections follow DataFusion's order. Sections DataFusion doesn't define (JSON Functions, URL Functions) come after, sorted by label.
    - Unlike DataFusion, it doesn't fail on undocumented functions, because #55 is still in progress. It lists them on stderr instead (10 right now: array_contains, map_from_arrays, map_from_entries, mod, parse_url, pmod, spark_cast, str_to_map, try_parse_url, xxhash64).
  • Add dev/update_function_docs.sh, which generates into a temporary directory and replaces docs/functions only on success, and commit the generated pages.

  • Add a function docs up to date job to lint.yml that regenerates the pages and fails if git status --porcelain -- docs/functions reports any change, including deleted or untracked files.

  • Document the workflow in CONTRIBUTING.md and AGENTS.md, and link the reference from the READMEs and crate docs.
  • The published datafusion-spark crate is unchanged apart from a doc comment link.

    Testing

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features --workspace -- -D warnings, cargo test -p datafusion-spark and cargo test -p datafusion-spark-sqllogictest pass.

  • Ran dev/update_function_docs.sh and checked the rendered pages. The split pages contain the same functions and aliases as the earlier single page, and a second run leaves the tree clean.

  • Made cargo fail during generation and checked that the existing pages were left untouched.
  • Diff: 316 lines (+237 / -79) across 3 files Reviewer: kosiew Review duration: 7074m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 316 lines diff across 3 files
    0.40
    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.345
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #115"
    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: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    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: 16.0% · Safe to merge
    16.0%