-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
@yesamer @baldimir
WIth this fix, we basically
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 ? |
@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. |
Ok, let's put this on hold and raise the point at the TCK meeting |
PR job Reproducerbuild-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:
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"} |
context
and context merge
missing functionalities
PR job Reproducerbuild-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:
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 |
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. |
@baldimir Still a WIP |
PR job Reproducerbuild-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:
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=-1text=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=-1text=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=-1text=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.testsum( [1,2,3] ) = 6org.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.evaluateWithInvalidFunctionInvocationNodeExpected '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=-1text=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.signavio.SignavioTest.zipFunctionsExpecting 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 |
@gitgabrio @baldimir Ready to be reviewed |
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.
HI @yesamer
You may be right, but it seems to me there are too many changes for this feature.
...mn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/profiles/ExtendedDMNProfileTest.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/AllFunction.java
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/AnyFunction.java
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/BaseFEELFunction.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/BaseFEELFunction.java
Outdated
Show resolved
Hide resolved
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/BaseFEELFunction.java
Outdated
Show resolved
Hide resolved
# 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
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.
Thx @yesamer LGTM!
…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
…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
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.