-
Notifications
You must be signed in to change notification settings - Fork 60
[FIX] evaluation: fix operation with empty matrices #6930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] evaluation: fix operation with empty matrices #6930
Conversation
db98c21
to
7c1ef64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jus a bit of nitpick ^^ what do you think?
src/functions/helper_statistical.ts
Outdated
|
||
export function assertNonEmpty(...data: any[][]) { | ||
if (data.length === 0 || data.some((arg) => arg.length === 0)) { | ||
throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably will need to be adapted in 18.4 following #6248
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was aware of that :)
src/functions/helper_statistical.ts
Outdated
|
||
export function assertNonEmpty(...data: any[][]) { | ||
if (data.length === 0 || data.some((arg) => arg.length === 0)) { | ||
throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input.")); | |
throw new NotAvailableError(_t("[[FUNCTION_NAME]] contains empty input data.")); |
only a part of the input is invalid in this case.
That being said, I like the idea of the assert above that provides the name of the faulty argument to help out.
maybe something like
throw new NotAvailableError(_t("[[FUNCTION_NAME]] expects the provided values of %(argName)s to contain values.", {argName}));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't be possible as the filterAndFlatData
used before will return both data_x
and data_y
filtered so that we ignore every value of an array if the value at the same position of the other array is undefined or null. So if we have data_X
OR data_Y
empty, both will be filtered to empty array
7c1ef64
to
019e255
Compare
Task Description When using empty matrices for math operation (multiplication or inversion), as in the FORECAST formula, we got a traceback and the error message was not clear for the user. This commits aims to fix it by checking that the matrices used in theses operations are not empty and returning an understandable error if it's not the case. Related Task Task: 5001658
019e255
to
3490d0e
Compare
robodoo r+ |
Task Description When using empty matrices for math operation (multiplication or inversion), as in the FORECAST formula, we got a traceback and the error message was not clear for the user. This commits aims to fix it by checking that the matrices used in theses operations are not empty and returning an understandable error if it's not the case. Related Task closes #6930 Task: 5001658 Signed-off-by: Rémi Rahir (rar) <[email protected]>
Task Description When using empty matrices for math operation (multiplication or inversion), as in the FORECAST formula, we got a traceback and the error message was not clear for the user. This commits aims to fix it by checking that the matrices used in theses operations are not empty and returning an understandable error if it's not the case. Related Task closes #6930 Task: 5001658 Signed-off-by: Rémi Rahir (rar) <[email protected]>
Task Description
When using empty matrices for math operation (multiplication or inversion), as in the FORECAST formula, we got a traceback and the error message was not clear for the user. This commits aims to fix it by checking that the matrices used in theses operations are not empty and returning an understandable error if it's not the case.
Related Task
review checklist