github-actions[bot] commented on code in PR #63563:
URL: https://github.com/apache/doris/pull/63563#discussion_r3772927454


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/RewriteCteChildren.java:
##########
@@ -172,7 +172,11 @@ private LogicalPlan pushPlanUnderAnchor(LogicalPlan plan) {
      * In this case, the only expression that can be pushed down to the 
producer is filter(a > 5 or a < 8).
      */
     private LogicalPlan tryToConstructFilter(CascadesContext cascadesContext, 
CTEId cteId, LogicalPlan child) {
-        Set<RelationId> consumerIds = 
cascadesContext.getCteIdToConsumers().get(cteId).stream()
+        Set<LogicalCTEConsumer> consumers = 
cascadesContext.getCteIdToConsumers().get(cteId);
+        if (consumers == null) {

Review Comment:
   `visitLogicalCTEAnchor` always puts an entry for this CTE ID before it 
visits the producer, and it returns without visiting the producer when that set 
is empty. Thus `null` here is not a supported no-filter case; it means the 
anchor/producer rewrite invariant has broken. Returning the child silently 
hides that failure and skips common-filter construction, contrary to the FE 
error-handling rule that unexpected states must fail. Please remove this 
fallback or replace it with an explicit invariant check that includes the CTE 
ID; `someone == null` below already handles the legitimate case where no 
consumer filter was collected.
   



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

Reply via email to