You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2025/05/20 07:40:54 UTC
[I] Custom Operator with executable-model [incubator-kie-drools]
tkobayas opened a new issue, #6350:
URL: https://github.com/apache/incubator-kie-drools/issues/6350
Custom operator fails with executable-model.
https://github.com/apache/incubator-kie-drools/blob/main/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CustomOperatorOnlyDrlTest.java
```
java.lang.AssertionError: [[Message [id=1, level=ERROR, path=src/main/java/defaultpkg/P7C/LambdaPredicate7C27EAD9213C766B596948C3121F3FA1.java, line=21, column=688
text=Type mismatch: cannot convert from String to boolean], Message [id=2, level=ERROR, path=src/main/java/defaultpkg/P7C/LambdaPredicate7C27EAD9213C766B596948C3121F3FA1.java, line=0, column=0
text=Java source of src/main/java/defaultpkg/P7C/LambdaPredicate7C27EAD9213C766B596948C3121F3FA1.java in error:
```
```
@org.drools.compiler.kie.builder.MaterializedLambda()
public enum LambdaPredicate7C27EAD9213C766B596948C3121F3FA1 implements org.drools.model.functions.Predicate1<defaultpkg.Tra48>, org.drools.model.functions.HashedExpression {
...
@Override()
public boolean test(defaultpkg.Tra48 _this) throws java.lang.Exception {
return _this.getName();
}
...
}
```
Adding tests with the following rules is enough to reproduce the issue.
```
rule R1
when
Person( name F_str[startsWith] "J")
then
end
```
```
rule R1
when
$s : String()
Person( name F_str[startsWith] $s)
then
end
```
Note that non-executable-model also fails with
```
java.lang.ClassCastException: class org.drools.core.common.DefaultFactHandle cannot be cast to class org.drools.mvel.compiler.Person (org.drools.core.common.DefaultFactHandle and org.drools.mvel.compiler.Person are in unnamed module of loader 'app')
at org.drools.base.org.drools.mvel.compiler.Person1651689839$getName.getValue(Unknown Source)
at org.drools.mvel.accessors.ClassFieldReader.getValue(ClassFieldReader.java:93)
at org.drools.compiler.integrationtests.CustomOperatorOnlyDrlTest$F_StrEvaluator.evaluateCachedLeft(CustomOperatorOnlyDrlTest.java:209)
```
if running ksession.insert/fireAllRules, but fixing `F_StrEvaluator` (e.g. `extractor.getValue(valueResolver, factHandle);` -> `extractor.getValue(valueResolver, factHandle.getObject());`) would solve it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Custom Operator issue with executable-model [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #6350:
URL: https://github.com/apache/incubator-kie-drools/issues/6350#issuecomment-3088825457
A custom operator with brackets is not supported.
Test case is fixed by https://github.com/apache/incubator-kie-drools/pull/6354
Document is added by https://github.com/apache/incubator-kie-docs/pull/4565
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [I] Custom Operator issue with executable-model [incubator-kie-drools]
Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas closed issue #6350: Custom Operator issue with executable-model
URL: https://github.com/apache/incubator-kie-drools/issues/6350
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org