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/11/25 10:01:23 UTC

[PR] Not exist mask [incubator-kie-drools]

tkobayas opened a new pull request, #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530

   - https://github.com/apache/incubator-kie-drools/issues/6529
   


-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563144356


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -123,6 +124,13 @@ protected void buildPattern(DeclarationSpec declarationSpec, List<PatternConstra
 
         if (pattern.isQuery()) {
             patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+        } else if (pattern.getSource() instanceof FromDescr fromDescr) {
+            String dataSourceText = fromDescr.getDataSource().getText();
+            boolean isEntryPoint = context.hasEntryPoint(dataSourceText);
+            boolean isRuleUnitVar = context.getRuleUnitVarType(dataSourceText) != null;
+            if (!isEntryPoint && !isRuleUnitVar) {
+                patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+            }

Review Comment:
   This is the main fix. Followed the same approach as non-exec-model https://github.com/apache/incubator-kie-drools/blob/main/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java#L300-L304
   
   If it's not passive, its segment is not considered as "eagerSegment", it misses to be masked (See `BuildtimeSegmentUtilities.updateNodeTypesMask`, `BuildtimeSegmentUtilities.requiresAnEagerSegment`, `SegmentMemorySupportImpl.initializePathMemory`), so results in "not fired".



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2564131017


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -70,6 +70,7 @@
 import static org.drools.mvel.parser.printer.PrintUtil.printNode;
 import static org.drools.util.StreamUtils.optionalToStream;
 
+import org.drools.drl.ast.descr.FromDescr;

Review Comment:
   The import for `FromDescr` should be placed with the other regular imports (around line 36-37, after `PatternSourceDescr`), not after the static imports. This follows standard Java import ordering conventions where regular imports come before static imports.



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2564236114


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -70,6 +70,7 @@
 import static org.drools.mvel.parser.printer.PrintUtil.printNode;
 import static org.drools.util.StreamUtils.optionalToStream;
 
+import org.drools.drl.ast.descr.FromDescr;

Review Comment:
   Fixed.



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas merged PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530


-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563144356


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -123,6 +124,13 @@ protected void buildPattern(DeclarationSpec declarationSpec, List<PatternConstra
 
         if (pattern.isQuery()) {
             patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+        } else if (pattern.getSource() instanceof FromDescr fromDescr) {
+            String dataSourceText = fromDescr.getDataSource().getText();
+            boolean isEntryPoint = context.hasEntryPoint(dataSourceText);
+            boolean isRuleUnitVar = context.getRuleUnitVarType(dataSourceText) != null;
+            if (!isEntryPoint && !isRuleUnitVar) {
+                patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+            }

Review Comment:
   Followed the same approach as non-exec-model https://github.com/apache/incubator-kie-drools/blob/main/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java#L300-L304



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563129579


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/RuleContext.java:
##########
@@ -363,7 +363,11 @@ public void addRuleUnitVarOriginalType(String name, Class<?> type) {
     }
 
     public Class<?> getRuleUnitVarType(String name) {
-        Class<?> varType = ruleUnitVars.get( name );
+        return ruleUnitVars.get( name );
+    }
+
+    public Class<?> getTypeFromRuleUnitVarsAndScopedDeclarations(String name) {
+        Class<?> varType = getRuleUnitVarType( name );

Review Comment:
   I split `getRuleUnitVarType` into `getRuleUnitVarType` and `getTypeFromRuleUnitVarsAndScopedDeclarations` to clarify the method's responsibility. Note that `scopedDeclarations.get("$p" )` looks to be a bug. I filed https://github.com/apache/incubator-kie-drools/issues/6531 as a separated issue.



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563144356


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -123,6 +124,13 @@ protected void buildPattern(DeclarationSpec declarationSpec, List<PatternConstra
 
         if (pattern.isQuery()) {
             patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+        } else if (pattern.getSource() instanceof FromDescr fromDescr) {
+            String dataSourceText = fromDescr.getDataSource().getText();
+            boolean isEntryPoint = context.hasEntryPoint(dataSourceText);
+            boolean isRuleUnitVar = context.getRuleUnitVarType(dataSourceText) != null;
+            if (!isEntryPoint && !isRuleUnitVar) {
+                patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+            }

Review Comment:
   This is the main fix. Followed the same approach as non-exec-model https://github.com/apache/incubator-kie-drools/blob/main/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java#L300-L304
   
   If it's not passive, its segment is not considered as "eagerSegment", it misses to be linked (See `BuildtimeSegmentUtilities.updateNodeTypesMask`, `BuildtimeSegmentUtilities.requiresAnEagerSegment`, `SegmentMemorySupportImpl.initializePathMemory`), so results in "not fired".



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563129579


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/RuleContext.java:
##########
@@ -363,7 +363,11 @@ public void addRuleUnitVarOriginalType(String name, Class<?> type) {
     }
 
     public Class<?> getRuleUnitVarType(String name) {
-        Class<?> varType = ruleUnitVars.get( name );
+        return ruleUnitVars.get( name );
+    }
+
+    public Class<?> getTypeFromRuleUnitVarsAndScopedDeclarations(String name) {
+        Class<?> varType = getRuleUnitVarType( name );

Review Comment:
   I split `getRuleUnitVarType` into `getRuleUnitVarType` and `getTypeFromRuleUnitVarsAndScopedDeclarations` to clarify the method's responsibility. Note that `scopedDeclarations.get("$p" )` below looks to be a bug. I filed https://github.com/apache/incubator-kie-drools/issues/6531 as a separated issue.



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563129579


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/RuleContext.java:
##########
@@ -363,7 +363,11 @@ public void addRuleUnitVarOriginalType(String name, Class<?> type) {
     }
 
     public Class<?> getRuleUnitVarType(String name) {
-        Class<?> varType = ruleUnitVars.get( name );
+        return ruleUnitVars.get( name );
+    }
+
+    public Class<?> getTypeFromRuleUnitVarsAndScopedDeclarations(String name) {
+        Class<?> varType = getRuleUnitVarType( name );

Review Comment:
   I split `getRuleUnitVarType` into `getRuleUnitVarType` and `getTypeFromRuleUnitVarsAndScopedDeclarations` to clarify the method's responsibility. Note that `scopedDeclarations.get("$p" )` looks to be a bug. I filed https://github.com/apache/incubator-kie-drools/issues/6531 



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563144356


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -123,6 +124,13 @@ protected void buildPattern(DeclarationSpec declarationSpec, List<PatternConstra
 
         if (pattern.isQuery()) {
             patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+        } else if (pattern.getSource() instanceof FromDescr fromDescr) {
+            String dataSourceText = fromDescr.getDataSource().getText();
+            boolean isEntryPoint = context.hasEntryPoint(dataSourceText);
+            boolean isRuleUnitVar = context.getRuleUnitVarType(dataSourceText) != null;
+            if (!isEntryPoint && !isRuleUnitVar) {
+                patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+            }

Review Comment:
   This is the main fix. Followed the same approach as non-exec-model https://github.com/apache/incubator-kie-drools/blob/main/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java#L300-L304



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#discussion_r2563144356


##########
drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/visitor/pattern/ClassPatternDSL.java:
##########
@@ -123,6 +124,13 @@ protected void buildPattern(DeclarationSpec declarationSpec, List<PatternConstra
 
         if (pattern.isQuery()) {
             patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+        } else if (pattern.getSource() instanceof FromDescr fromDescr) {
+            String dataSourceText = fromDescr.getDataSource().getText();
+            boolean isEntryPoint = context.hasEntryPoint(dataSourceText);
+            boolean isRuleUnitVar = context.getRuleUnitVarType(dataSourceText) != null;
+            if (!isEntryPoint && !isRuleUnitVar) {
+                patternExpression = new MethodCallExpr( patternExpression, PASSIVE_CALL );
+            }

Review Comment:
   This is the main fix. Followed the same approach as non-exec-model https://github.com/apache/incubator-kie-drools/blob/main/drools-compiler/src/main/java/org/drools/compiler/rule/builder/PatternBuilder.java#L300-L304
   
   If it's not passive, its segment is not considered as "eagerSegment", it misses to be eagerly linked (See `BuildtimeSegmentUtilities.updateNodeTypesMask`, `BuildtimeSegmentUtilities.requiresAnEagerSegment`, `SegmentMemorySupportImpl.initializePathMemory`), so results in "not fired".



-- 
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: [PR] [incubator-kie-drools-6529] executable-model misses to flag passive for a pattern with FromNode [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #6530:
URL: https://github.com/apache/incubator-kie-drools/pull/6530#issuecomment-3574795377

   Will add RuleUnit test too.


-- 
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