yesamer commented on code in PR #5762:
URL:
https://github.com/apache/incubator-kie-drools/pull/5762#discussion_r1512664929
##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/accumulate/AccumulateVisitor.java:
##########
@@ -406,10 +414,10 @@ private boolean
parameterNeedsConvertionToMethodCallExpr(Expression accumulateFu
return accumulateFunctionParameter.isMethodCallExpr() ||
accumulateFunctionParameter.isArrayAccessExpr() ||
accumulateFunctionParameter.isFieldAccessExpr();
}
- private Optional<NewBinding> binaryExprParameter(PatternDescr basePattern,
AccumulateDescr.AccumulateFunctionCallDescr function, MethodCallExpr
functionDSL, String bindingId, String accumulateFunctionParameterStr) {
+ private Optional<NewBinding> binaryOrUnaryExprParameter(PatternDescr
basePattern, AccumulateDescr.AccumulateFunctionCallDescr function,
MethodCallExpr functionDSL, String bindingId, String
accumulateFunctionParameterStr) {
Review Comment:
Thank you, done!
##########
drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/AccumulateTest.java:
##########
@@ -4204,4 +4206,80 @@ public void testJoinInAccumulate() {
assertThat(results.size()).isEqualTo(2);
assertThat(results).containsExactlyInAnyOrder(new Result(0), new
Result(75));
}
+
+ @Test
+ public void testAccumulateSumMultipleParametersExpression() {
+ String str =
+ "import " + Person.class.getCanonicalName() + ";" +
+ "import " + Result.class.getCanonicalName() + ";" +
+ "rule X when\n" +
+ " accumulate ( $i : Integer() and $p: Person ( name.length >=
$i ); \n" +
+ " $sum : sum($p.getAge(), $p.getName()) \n" +
+ " ) \n" +
+ "then\n" +
+ " insert(new Result($sum));\n" +
+ "end";
+
+ Results results = createKieBuilder(str).getResults();
+ if (testRunType.isExecutableModel()) {
+
System.out.println(results.getMessages(Message.Level.ERROR).get(0).getText());
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]