dssysolyatin commented on code in PR #4145:
URL: https://github.com/apache/calcite/pull/4145#discussion_r2639596953


##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnOrigins.java:
##########
@@ -303,8 +306,16 @@ private static Set<RelColumnOrigin> 
getMultipleColumns(RexNode rexNode, RelNode
             }
             return null;
           }
+
+          @Override public Void visitFieldAccess(RexFieldAccess fieldAccess) {

Review Comment:
   I think there is a bug. What if `fieldAccess.getReferenceExpr()` is input 
ref ? For example: 'struct_column.field1.field2'. `struct_column` is InputRef. 
   
   Or:
   ```java
   $cor0.struct_field.field_1
   ```
   
   I think implementation should be:
   ```java
   @Override public Void visitFieldAccess(RexFieldAccess fieldAccess) {
         if (fieldAccess.getReferenceExpr() instanceof RexCorrelVariable) {
                 throw Util.FoundOne.NULL;
               }
           return super.visitFieldAccess(fieldAccess)
   }
   ```
   
   Or probably just use
   ```java
   @Override public R visitCorrelVariable(RexCorrelVariable correlVariable) {
       throw Util.FoundOne.NULL;
     }
     ```



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

Reply via email to