Skip to content
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

[kie-issues#1330] FEEL functions that expect List parameters, should coerce single item to a List #5997

Merged
merged 23 commits into from
Jul 17, 2024

Conversation

yesamer
Copy link
Contributor

@yesamer yesamer commented Jun 19, 2024

Closes: apache/incubator-kie-issues#1330

According to the Specs:

10.3.2.9.4 Type conversions
to singleton list:
When the type of the expression is T and the target type is List the expression is converted to a
singleton list.
from singleton list:
When the type of the expression is List, the value of the expression is a singleton list and the target
type is T, the expression is converted by unwrapping the first element.

This PR implements the second part of that paragraph: passing any single element to any function that requires a list, the code will automatically coerce it to a List with a single element.

As a consequence, I removed all the methods in the function that take the single element when expecting a list.

@yesamer yesamer added the DMN label Jun 19, 2024
@gitgabrio
Copy link
Contributor

gitgabrio commented Jun 19, 2024

@yesamer @baldimir
I'm not 100% sure of the underlying problem.
From the spec, I see that both contextand context merge requires a list of contexts.
I agree that the list could contain only one single item, but regardless the dmn model should define it as list, e.g.

[context_parameter] instead of context_parameter.

WIth this fix, we basically

  1. create a new "method" that accept a single element (not defined by DMN spec)
  2. behind the scene, invoke the correct one, with a single-element list.

If my understanding is correct, it would mean that users could create an invalid model, that works only with our implementation.

Does this make sense ? Am I wrong on some assumption ?

@yesamer
Copy link
Contributor Author

yesamer commented Jun 19, 2024

@gitgabrio I agree with you, but the point is that the TCK tests expect that kind of behavior. That means other vendors that successfully perform the TCK tests already implemented that. So, the alternative to merging this PR is to raise this point to the TCK meeting and double-check if those tests are correct or not, considering that the specs don't define those methods specifically.

@gitgabrio
Copy link
Contributor

gitgabrio commented Jun 19, 2024

@gitgabrio I agree with you, but the point is that the TCK tests expect that kind of behavior. That means other vendors that successfully perform the TCK tests already implemented that. So, the alternative to merging this PR is to raise this point to the TCK meeting and double-check if those tests are correct or not, considering that the specs don't define those methods specifically.

Yup, exactly.
IIUC the process, those tests does not comes from the committee itself, but from the tck group that, again IIUC, does not have any real ownership on the specs.
If those tests does not reflect the actual spec, then they are invalid, and I'm not sure why they are there and why, if, that behavior has been implemented.
If all the above is true, IMO, those tests (and all the others that does not reflect the actual spec) should be deleted, or at least ignored.

@yesamer
Copy link
Contributor Author

yesamer commented Jun 19, 2024

Ok, let's put this on hold and raise the point at the TCK meeting

@kie-ci3
Copy link

kie-ci3 commented Jun 19, 2024

PR job #1 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-drools -u #5997 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-5997/1/display/redirect

Test results:

  • PASSED: 22041
  • FAILED: 2

Those are the test failures:

org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[153] [Evaluating: 'context([{key: "name", value: "John Doe"},{"key": "age", "value": null}])']
expected: null
but was: {"age"=null, "name"="John Doe"}
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[154] [Evaluating: 'context([{key: "name", value: "John Doe"},{"key": "age", "value": null}])']
expected: null
but was: {"age"=null, "name"="John Doe"}

@yesamer yesamer changed the title [kie-issues#1330] context and context merge missing functionalities [kie-issues#1330] FEEL functions that expect List parameters, should coerce single item to a List Jun 20, 2024
@yesamer yesamer marked this pull request as draft June 20, 2024 15:16
@kie-ci3
Copy link

kie-ci3 commented Jun 20, 2024

PR job #3 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-drools -u #5997 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-5997/3/display/redirect

Test results:

  • PASSED: 22047
  • FAILED: 1

Those are the test failures:

org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[324] [Evaluating: 'concat("abc")']
expected: "abc"
but was: null

@baldimir
Copy link
Contributor

baldimir commented Jun 21, 2024

Is this ready for review after the discussions please? The coercion from list with a single item to single item and vice versa is defined in the spec in 10.3.2.9.4 Type conversions. The TCK tests are valid.

@yesamer
Copy link
Contributor Author

yesamer commented Jun 21, 2024

@baldimir Still a WIP

@kie-ci3
Copy link

kie-ci3 commented Jun 21, 2024

PR job #5 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-drools -u #5997 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-5997/5/display/redirect

Test results:

  • PASSED: 22138
  • FAILED: 48

Those are the test failures:

org.kie.dmn.core.DMNRuntimeTest.ex61(boolean)[1] [Message [id=0, level=ERROR, path=Ex_6_1.dmn, line=159, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum(NBA Pacific.bonus points)': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _decisionbonuspointsliteralexpression, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Ex_6_1.dmn, line=103, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'mean(NBA Pacific.wins)': The parameter 'list', in function mean(), unable to sum the elements which is required to calculate the mean. (DMN id: _5d95b79e-1500-4206-95c3-123831f7aabe, FEEL expression evaluation error) ]]
Expecting value to be false but was true
org.kie.dmn.core.v1_4.DMN14specificTest.dMNv14Ch11Example2(VariantTestConf)[1] [Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]]
Expecting value to be false but was true
org.kie.dmn.core.v1_4.DMN14specificTest.dMNv14Ch11Example2(VariantTestConf)[2] [Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1056, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum([Loan Info.Qualifying Monthly Payment, Propert... [string clipped after 50 chars, total length is 155]': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _f0f68868-ef1c-455d-a438-fd91c7378b16, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1053, column=-1
text=DMN: Error evaluating context extry 'Housing Expense' on context 'Eligibility Parameters' (DMN id: _d4558837-ad20-4ed3-8099-e5142be3797c, Error evaluating context or context entry) ]
Message [id=0, level=WARNING, path=Recommended Loan Products.dmn, line=452, column=-1
text=DMN: No rule matched for decision table 'Min Credit Score' and no default values were defined. Setting result to null. (DMN id: _a6e2c692-4a0c-4385-bbc3-7280e94a8760, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=827, column=-1
text=DMN: Unrecoverable error evaluating context extry 'Required Credit Score' on context 'Eligibility': Cannot invoke "Object.toString()" because "r" is null (DMN id: _fbf39f7b-79c3-470c-82ff-62d685f1f297, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1140, column=-1
text=DMN: Error while evaluating node 'Required Credit Score': the declared result type is 'DMNType{ http://www.trisotech.com/definitions/_736fa164-03d8-429f-8318-4913a548c3a6 : tCreditScore }' but the actual value 'null' is not an instance of that type (DMN id: _9da73807-1031-4622-9b65-f1fbe8b1b7ed, Error evaluating node) ]
Message [id=0, level=ERROR, path=Recommended Loan Products.dmn, line=1116, column=-1
text=DMN: Error evaluating context extry 'formatted row' on context 'Format Row' (DMN id: _5ccce417-75fd-4d60-b014-695bb847cb31, Error evaluating context or context entry) ]]
Expecting value to be false but was true
org.kie.dmn.feel.documentation.ADocFEELExamplesTest.test sum( [1,2,3] ) = 6
org.kie.dmn.feel.lang.examples.ExamplesTest.loadExample1064
expected: 5500.00
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[117] [Evaluating: 'sum([ 1, 2, 3 ])']
expected: 6
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[118] [Evaluating: 'sum([ 1, 2, 3 ])']
expected: 6
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[119]
fEELEventListener.onEvent(

);
Never wanted here:
-> at org.kie.dmn.feel.runtime.BaseFEELTest.expression(BaseFEELTest.java:81)
But invoked here:
-> at org.kie.dmn.feel.lang.impl.FEELEventListenersManager.lambda$notifyListeners$0(FEELEventListenersManager.java:75) with arguments: [InvalidParametersEvent{getSeverity()=ERROR, nodeName=sum, message=The parameter 'list', in function sum(), an element in the list is not a number., actualParameters={n=[[]]}, paramNameInError=list, paramProblem=an element in the list is not a number, getSourceException()=null}]
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[120]
fEELEventListener.onEvent(

);
Never wanted here:
-> at org.kie.dmn.feel.runtime.BaseFEELTest.expression(BaseFEELTest.java:81)
But invoked here:
-> at org.kie.dmn.feel.lang.impl.FEELEventListenersManager.lambda$notifyListeners$0(FEELEventListenersManager.java:75) with arguments: [InvalidParametersEvent{getSeverity()=ERROR, nodeName=sum, message=The parameter 'list', in function sum(), an element in the list is not a number., actualParameters={n=[[]]}, paramNameInError=list, paramProblem=an element in the list is not a number, getSourceException()=null}]
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[123] [Evaluating: 'product([ 2, 3, 4 ])']
expected: 24
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[124] [Evaluating: 'product([ 2, 3, 4 ])']
expected: 24
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[129] [Evaluating: 'mean([ 1, 2, 3 ])']
expected: 2
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[130] [Evaluating: 'mean([ 1, 2, 3 ])']
expected: 2
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[331] [Evaluating: 'all( [true, false] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[332] [Evaluating: 'all( [true, false] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[333] [Evaluating: 'all( [true, true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[334] [Evaluating: 'all( [true, true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[335] [Evaluating: 'all( [false,null,true] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[336] [Evaluating: 'all( [false,null,true] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[337] [Evaluating: 'all( [] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[338] [Evaluating: 'all( [] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[355] [Evaluating: 'any( [true, false] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[356] [Evaluating: 'any( [true, false] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[357] [Evaluating: 'any( [true, true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[358] [Evaluating: 'any( [true, true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[359] [Evaluating: 'any( [false,null,true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[360] [Evaluating: 'any( [false,null,true] )']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[361] [Evaluating: 'any( [] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[362] [Evaluating: 'any( [] )']
expected: false
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[33] [Evaluating: 'nn sum( [] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[34] [Evaluating: 'nn sum( [] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[35] [Evaluating: 'nn sum( [ null ] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[36] [Evaluating: 'nn sum( [ null ] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[37] [Evaluating: 'nn sum( [ null, null ] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.KieFEELExtendedFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[38] [Evaluating: 'nn sum( [ null, null ] )']
expected: 0
but was: null
org.kie.dmn.feel.runtime.functions.extended.RangeFunctionTest.evaluateWithInvalidFunctionInvocationNode Expected 'retrieved.isLeft()' from, [all( [true, false] )..all( [true, false] )]
org.kie.dmn.legacy.tests.core.v1_1.DMNRuntimeTest.ex61(VariantTestConf)[1] [Message [id=0, level=ERROR, path=Ex_6_1.dmn, line=109, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'sum(NBA Pacific.bonus points)': The parameter 'list', in function sum(), an element in the list is not a number. (DMN id: _decisionbonuspointsliteralexpression, FEEL expression evaluation error) ]
Message [id=0, level=ERROR, path=Ex_6_1.dmn, line=73, column=-1
text=DMN: FEEL ERROR while evaluating literal expression 'mean(NBA Pacific.wins)': The parameter 'list', in function mean(), unable to sum the elements which is required to calculate the mean. (DMN id: _5d95b79e-1500-4206-95c3-123831f7aabe, FEEL expression evaluation error) ]]
Expecting value to be false but was true
org.kie.dmn.ruleset2dmn.ChurnRulesFromSPSSModelerTest.test
expected: "T"
but was: null
org.kie.dmn.signavio.SignavioTest.zipFunctions
Expecting actual not to be null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[3] [Evaluating: 'all([ true, true, true ])']
expected: true
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[7] [Evaluating: 'any([ false, true, false ])']
expected: true
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[9] [Evaluating: 'any([ false, false, false ])']
expected: false
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[41] [Evaluating: 'product( [ 2, 3, 4 ] )']
expected: 24
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[44] [Evaluating: 'product( [] )']
expected: 0
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[258] [Evaluating: 'zip(["id", "value"], [["23a3e98", "c45da1b"], [40, 120]])']
expected: [{"id"="23a3e98", "value"=40}, {"id"="c45da1b", "value"=120}]
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[270] [Evaluating: 'avg([3,5])']
expected: 4
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[271] [Evaluating: 'avg([3,4,5])']
expected: 4
but was: null
org.kie.dmn.signavio.feel.runtime.FEELExtendedFunctionsTest.instanceTest(String, Object, Severity)[272] [Evaluating: 'avg([4,5])']
expected: 4.5
but was: null

@yesamer yesamer marked this pull request as ready for review June 27, 2024 07:47
@yesamer
Copy link
Contributor Author

yesamer commented Jun 27, 2024

@gitgabrio @baldimir Ready to be reviewed

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @yesamer
You may be right, but it seems to me there are too many changes for this feature.

# Conflicts:
#	kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/KieFEELExtendedFunctionsTest.java
# Conflicts:
#	kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/util/CoerceUtil.java
#	kie-dmn/kie-dmn-signavio/src/main/java/org/kie/dmn/signavio/feel/runtime/functions/ConcatFunction.java
Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @yesamer LGTM!

@yesamer yesamer merged commit 09c1505 into apache:main Jul 17, 2024
10 checks passed
@yesamer yesamer deleted the kie-issues#1330 branch July 17, 2024 12:19
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Jul 17, 2024
…coerce single item to a List (apache#5997)

* Fix + Tests

* Fix + Tests

* Fix + Tests

* Tests fixed

* Fix + Tests

* Fix + Tests

* Fix

* Revert

* Fix

* Fix

* Improving scoring

* BaseFEELFunction updated

* BaseFEELFunction updated

* Revert context function

* context function

* Revert some changes + Tests

* Change
rodrigonull pushed a commit to rodrigonull/incubator-kie-drools that referenced this pull request Oct 7, 2024
…coerce single item to a List (apache#5997)

* Fix + Tests

* Fix + Tests

* Fix + Tests

* Tests fixed

* Fix + Tests

* Fix + Tests

* Fix

* Revert

* Fix

* Fix

* Improving scoring

* BaseFEELFunction updated

* BaseFEELFunction updated

* Revert context function

* context function

* Revert some changes + Tests

* Change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FEEL functions that expect List parameters, should coerce single item to a List
4 participants