Skip to content

Fix MAD UDF exact calculation and silent approximate result - #19162

Merged
JackieTien97 merged 1 commit into
apache:masterfrom
alpass163:cyb/fix_udf_function_mad
Nov 6, 2026
Merged

JackieTien97 merged 1 commit into
apache:masterfrom
alpass163:cyb/fix_udf_function_mad

Conversation

@alpass163

Copy link
Copy Markdown
Contributor

The exact MAD path has been broken since the UDF was introduced: the four getMad overloads (INT32/INT64/FLOAT/DOUBLE) create an empty DoubleArrayList and then call set(i, ...) on it. set() requires the index to be smaller
than the list size, so the first iteration always throws IndexOutOfBoundsException. Replace set() with add() and pre-size the list.
mad(x) now returns the correct value (0.78 for the reported 24-point series).

@JackieTien97
JackieTien97 merged commit 9a386ab into apache:master Nov 6, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants