Skip to content

fix: return 1 from regr_r2 for a horizontal line, not NULL - #27286

Open
MaxFreedomPollard wants to merge 1 commit into
apache:mainfrom
MaxFreedomPollard:fix/regr-r2-horizontal-line
Open

MaxFreedomPollard wants to merge 1 commit into
apache:mainfrom
MaxFreedomPollard:fix/regr-r2-horizontal-line

Conversation

@MaxFreedomPollard

Copy link
Copy Markdown
Contributor

regr_r2(y, x) returned NULL whenever all y values were equal. The SQL standard, PostgreSQL, DuckDB and Spark return NULL only when all x values are equal (a vertical line), and 1 when all y values are equal but the x values are not (a horizontal line, which fits every point).

Important

Fork CI setup: For pull requests from a fork to main, enable workflows in your fork's Actions tab before you push.
See the fork CI setup guide.

Which issue does this PR close?

  • Closes #.

Rationale for this change

What changes are included in this PR?

What is the testing strategy for this PR?

Are there any user-facing changes?

regr_r2(y, x) returned NULL whenever all y values were equal. The SQL
standard, PostgreSQL, DuckDB and Spark return NULL only when all x values
are equal (a vertical line), and 1 when all y values are equal but the x
values are not (a horizontal line, which fits every point).
@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant