[docs](function) add REGR aggregate function docs for current and 4.x#3544
[docs](function) add REGR aggregate function docs for current and 4.x#3544zclllyybb merged 3 commits intoapache:masterfrom
Conversation
|
/review |
There was a problem hiding this comment.
Pull request overview
Adds documentation coverage for the REGR* linear-regression aggregate function family across current and version-4.x docs, including sidebar registration and Chinese translations.
Changes:
- Add new docs pages for
REGR_AVGX,REGR_AVGY,REGR_COUNT,REGR_R2,REGR_SXX,REGR_SXY,REGR_SYY(current + 4.x, EN + zh-CN). - Refresh existing
REGR_SLOPEandREGR_INTERCEPTpages with clearer descriptions and consistent examples. - Update
sidebars.tsandversion-4.x-sidebars.jsonto include the new function pages.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| versioned_sidebars/version-4.x-sidebars.json | Adds new REGR* doc IDs to the 4.x sidebar navigation. |
| sidebars.ts | Adds new REGR* doc IDs to the current sidebar navigation. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-avgx.md | New 4.x EN doc for REGR_AVGX. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-avgy.md | New 4.x EN doc for REGR_AVGY. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-count.md | New 4.x EN doc for REGR_COUNT. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-r2.md | New 4.x EN doc for REGR_R2. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-sxx.md | New 4.x EN doc for REGR_SXX. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-sxy.md | New 4.x EN doc for REGR_SXY. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-syy.md | New 4.x EN doc for REGR_SYY. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-intercept.md | Updates 4.x EN REGR_INTERCEPT description/example. |
| versioned_docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-slope.md | Updates 4.x EN REGR_SLOPE description/example. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-avgx.md | New current EN doc for REGR_AVGX. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-avgy.md | New current EN doc for REGR_AVGY. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-count.md | New current EN doc for REGR_COUNT. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-r2.md | New current EN doc for REGR_R2. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-sxx.md | New current EN doc for REGR_SXX. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-sxy.md | New current EN doc for REGR_SXY. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-syy.md | New current EN doc for REGR_SYY. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-intercept.md | Updates current EN REGR_INTERCEPT description/example. |
| docs/sql-manual/sql-functions/aggregate-functions/regr-slope.md | Updates current EN REGR_SLOPE description/example. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-avgx.md | New 4.x zh-CN doc for REGR_AVGX. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-avgy.md | New 4.x zh-CN doc for REGR_AVGY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-count.md | New 4.x zh-CN doc for REGR_COUNT. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-r2.md | New 4.x zh-CN doc for REGR_R2. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-sxx.md | New 4.x zh-CN doc for REGR_SXX. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-sxy.md | New 4.x zh-CN doc for REGR_SXY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-syy.md | New 4.x zh-CN doc for REGR_SYY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-intercept.md | Updates 4.x zh-CN REGR_INTERCEPT description/example. |
| i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/aggregate-functions/regr-slope.md | Updates 4.x zh-CN REGR_SLOPE description/example. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-avgx.md | New current zh-CN doc for REGR_AVGX. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-avgy.md | New current zh-CN doc for REGR_AVGY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-count.md | New current zh-CN doc for REGR_COUNT. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-r2.md | New current zh-CN doc for REGR_R2. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-sxx.md | New current zh-CN doc for REGR_SXX. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-sxy.md | New current zh-CN doc for REGR_SXY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-syy.md | New current zh-CN doc for REGR_SYY. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-intercept.md | Updates current zh-CN REGR_INTERCEPT description/example. |
| i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/aggregate-functions/regr-slope.md | Updates current zh-CN REGR_SLOPE description/example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review Summary
This PR adds documentation for seven new REGR aggregate functions (REGR_AVGX, REGR_AVGY, REGR_COUNT, REGR_R2, REGR_SXX, REGR_SXY, REGR_SYY) and updates two existing ones (REGR_SLOPE, REGR_INTERCEPT). All four doc trees are updated (current, 4.x, zh-CN current, zh-CN 4.x). Sidebars are correctly updated in both sidebars.ts and versioned_sidebars/version-4.x-sidebars.json. New 4.x functions correctly carry a "supported since 4.1.0" info note.
Critical Checkpoint Conclusions
Goal and Implementation: The goal is to document the REGR aggregate function family for current (dev) and 4.x. The implementation satisfies the goal — all required functions are documented in all four trees.
Change scope: Appropriately scoped to documentation. No unrelated reformatting.
Documentation information architecture: All four trees are consistently updated. Sidebar entries correctly list all nine functions in alphabetical order. The PR correctly marks 3.x and 2.1 as not updated (new functions don't exist there).
Page paths / Anchors / Navigation: No pages were moved or renamed. New pages follow the existing regr-* filename convention. Sidebar entries correctly reference the new file slugs in both sidebars.ts and versioned_sidebars/version-4.x-sidebars.json.
Docusaurus config / React / Styling: Not touched.
Mathematical Correctness: All example output values were independently verified:
- Group 1 (id=1): only
(x=0, y=NULL)— no valid pairs → COUNT=0, all others NULL ✓ - Group 2 (id=2): pairs
(1,3),(2,5),(3,7),(4,9)— perfect linear fit y=2x+1- REGR_AVGX=2.5, REGR_AVGY=6.0, REGR_COUNT=4 ✓
- REGR_SXX=5.0, REGR_SXY=10.0, REGR_SYY=20.0 ✓
- REGR_SLOPE=2.0, REGR_INTERCEPT=1.0 ✓
- REGR_R2=1.0 (perfect linear correlation) ✓
- REGR_R2 edge cases: group 3 (VAR_POP(x)=0 → NULL), group 4 (VAR_POP(y)=0 → 1) ✓
SQL Function Doc Standards: All required sections present in order: Description, Syntax, Parameters, Return Value, Example. REGR_R2's branching NULL logic is clearly documented in Return Value.
Chinese/English consistency: Content is factually consistent across EN and zh-CN versions. The 4.x versions include the :::info version note; the current docs correctly omit it.
Issues Found
Issue 1 (Significant): Output table misalignment in docs/regr-intercept.md
The English current (docs/) regr-intercept.md output table has two rows shorter than the border:
+------+------------------------+ ← 24 dashes in col 2
| id | REGR_INTERCEPT(y, x) | ← col 2 is 22 chars wide (missing 2)
+------+------------------------+
| 1 | NULL | ← col 2 is 22 chars (OK)
| 2 | 1.0 | ← col 2 is 20 chars (missing 4)
Correction:
+------+------------------------+
| id | REGR_INTERCEPT(y, x) |
+------+------------------------+
| 1 | NULL |
| 2 | 1.0 |
+------+------------------------+
Note: the 4.x and zh-CN versions of this file are correctly aligned.
Issue 2 (Minor): Header row alignment in docs/ English files
All new files under docs/ (English current) have the header row 1 character shorter than the border. Example from regr-avgx.md:
+------+--------------------+ ← 20 dashes
| id | REGR_AVGX(y, x) | ← 19 chars (1 missing trailing space)
Affected files: regr-avgx, regr-avgy, regr-count, regr-r2, regr-slope, regr-sxx, regr-sxy, regr-syy in docs/. Also regr-avgx and regr-sxx in versioned_docs/version-4.x/. The zh-CN current versions are correctly aligned.
Issue 3 (Minor): Missing equivalence formula for REGR_SLOPE
REGR_INTERCEPT includes its formula (AVG(y) - REGR_SLOPE(y, x) * AVG(x)), and REGR_SXX/REGR_SXY/REGR_SYY each state their equivalence formula. For consistency and user understanding, consider adding to REGR_SLOPE's Description:
It is equivalent to
COVAR_POP(y, x) / VAR_POP(x).
This applies to all four doc trees.
Versions
Add REGR aggregate function docs for apache/doris#61352
Languages
Docs Checklist