Closed magicprinc closed 1 year ago
Thanks, can confirm. Will look into this soon
The test is correct. The expected result is 1.0
:
select regr_r2(x, y)
from (values (1, 1), (1, 2)) t (x, y)
Produces:
|regr_r2|
|-------|
|1 |
https://github.com/jOOQ/jOOQ/issues/11547 defines REGR_R2
as:
REGR_R2(x, y) = CASE
WHEN VAR_POP(NVL2(x, y, NULL)) = 0 THEN NULL
WHEN VAR_POP(NVL2(y, x, NULL)) = 0 THEN 1
ELSE CORR(x, y)^2
END
The formula is implemented correctly, but the internal mapAll(Tuple3<Optional<T1>, Optional<T2>, Optional<T3>>)
isn't. It's requires all optionals to be non-empty in order to map anything, when in fact this isn't what the CASE
expression suggests.
Well, mapAll()
is implemented correctly, but using it is wrong.
The reason why this hasn't been detected in our CI is because we recently migrated CI and jOOλ wasn't part of the new installation...
This is not something I have made. I checked out last sources from jOOQ/jOOL repo and ran maven: The test has failed.
I don't use it, so I don't dare to touch it.