hulincup opened a new pull request, #58158: URL: https://github.com/apache/spark/pull/58158
### What changes were proposed in this pull request? This fixes the broken HTML table on the generated [sql-error-conditions](https://spark.apache.org/docs/latest/sql-error-conditions.html) page. The doc generator (`docs/_plugins/build-error-docs.py`, `assemble_message`) wraps every `<placeholder>` token in inline-code backticks via `re.sub(r"(<.*?>)", lambda x: f"\`{x.group(1)}\`", message)`. When a message already contains an inline code span that embeds a placeholder — e.g. `` `APPROX NEAREST <numResults> BY ...` `` (`NUM_RESULTS_OUT_OF_RANGE`) or `` `_udf_param_<index>` `` (`INVALID_UDF_PARAMETER_PLACEHOLDER_INDEX`) — the substitution inserts backticks *inside* the existing span and splits it. The placeholder then leaks as raw HTML (e.g. `<numResults>`), which the browser interprets as an unknown tag and uses to break the surrounding `<table>` structure (a stray `</table>` appears mid-row, truncating the rest of the table). The fix stashes existing inline code spans before wrapping the bare placeholders, then restores them untouched, so `markdown` escapes their angle-bracket content as HTML entities inside a single intact `<code>` span. ### Why are the changes needed? The error-conditions table renders broken on the live docs site (reported in #58094 with a screenshot). Conditions after `NUM_RESULTS_OUT_OF_RANGE` / `INVALID_UDF_PARAMETER_PLACEHOLDER_INDEX` get truncated and the placeholder text is mangled. ### Does this PR introduce any user-facing change? Docs only. The generated `sql-error-conditions.html` table renders correctly; placeholders that previously leaked as raw tags now render as escaped inline code. No runtime behavior change. ### How was this patch tested? Ran the generator locally (`python docs/_plugins/build-error-docs.py` with `mkdocs` installed) before and after the change on the current `error-conditions.json`: - **Before:** 2 raw `<numResults>` + 2 raw `<index>` tags leaked into the HTML; the table structure was broken (confirmed: `<code>APPROX NEAREST</code><numResults><code>BY ...</code>`). - **After:** 0 raw placeholder tags. `NUM_RESULTS_OUT_OF_RANGE` now renders as `<code>APPROX NEAREST <numResults> BY ...</code>` and `INVALID_UDF_PARAMETER_PLACEHOLDER_INDEX` as `<code>_udf_param_<index></code>`. - The table keeps a single matched `<table>`/`</table>` with unchanged row count; previously working messages (e.g. `<dataSource>`) render identically (no regression). Closes #58094 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
