924060929 commented on code in PR #11454:
URL: https://github.com/apache/doris/pull/11454#discussion_r936291379


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSlotReference.java:
##########
@@ -156,7 +179,12 @@ public Expression visitUnboundAlias(UnboundAlias 
unboundAlias, Void context) {
         }
 
         @Override
-        public Slot visitUnboundSlot(UnboundSlot unboundSlot, Void context) {
+        public Slot visitUnboundSlot(UnboundSlot unboundSlot, PlannerContext 
context) {
+            List<Slot> tmpBound = bindSlot(unboundSlot, getScope().getSlots());
+            boolean hasCorrelate = false;
+            if (tmpBound.size() == 0) {
+                hasCorrelate = true;
+            }
             Optional<List<Slot>> boundedOpt = getScope()

Review Comment:
   why compute bind slot in thisScope again, I think it should be
   ```java
   if (!foundInThisScope && getScope.getOuterScope().isPresent()) {
      Optional<List<Slot>> boundedOpt = getScope()
           .getParentScope()
           .get()
           .toScopeLink()
           .stream()
           ...
   }
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSlotReference.java:
##########
@@ -156,7 +179,12 @@ public Expression visitUnboundAlias(UnboundAlias 
unboundAlias, Void context) {
         }
 
         @Override
-        public Slot visitUnboundSlot(UnboundSlot unboundSlot, Void context) {
+        public Slot visitUnboundSlot(UnboundSlot unboundSlot, PlannerContext 
context) {
+            List<Slot> tmpBound = bindSlot(unboundSlot, getScope().getSlots());
+            boolean hasCorrelate = false;
+            if (tmpBound.size() == 0) {
+                hasCorrelate = true;
+            }
             Optional<List<Slot>> boundedOpt = getScope()

Review Comment:
   why compute bind slot in thisScope again, I think it should be
   ```java
   if (!foundInThisScope && getScope.getOuterScope().isPresent()) {
      Optional<List<Slot>> boundedOpt = getScope()
           .getOuterScope()
           .get()
           .toScopeLink()
           .stream()
           ...
   }
   ```



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to