cecemei commented on code in PR #18334:
URL: https://github.com/apache/druid/pull/18334#discussion_r2246373266


##########
processing/src/main/java/org/apache/druid/segment/virtual/ExpressionVirtualColumn.java:
##########
@@ -125,8 +124,11 @@ private ExpressionVirtualColumn(
   )
   {
     this.name = Preconditions.checkNotNull(name, "name");
-    this.expression = new Expression(Preconditions.checkNotNull(expression, 
"expression"), outputType);
-    this.parsedExpression = parsedExpression;
+    this.expression = new Expression(

Review Comment:
   since `parsedExpression.get()` is already called in line 132, why does 
`Expression` need a `Supplier<Expr>` instead of just `Expr`? Maybe 
`Parser.lazyParse` is not needed?



##########
processing/src/main/java/org/apache/druid/segment/virtual/ExpressionVirtualColumn.java:
##########
@@ -367,13 +369,14 @@ public boolean equals(final Object o)
     }
     final ExpressionVirtualColumn that = (ExpressionVirtualColumn) o;
     return Objects.equals(name, that.name) &&
-           Objects.equals(expression, that.expression);
+           Objects.equals(expression.expressionString, 
that.expression.expressionString) &&
+           Objects.equals(expression.outputType, that.expression.outputType);
   }
 
   @Override
   public int hashCode()
   {
-    return Objects.hash(name, expression);
+    return Objects.hash(name, expression.expressionString, 
expression.outputType);

Review Comment:
   what's the difference between `expressionString` and 
`expression.parsed.get().stringify()`?



##########
processing/src/main/java/org/apache/druid/segment/virtual/ExpressionVirtualColumn.java:
##########
@@ -449,20 +456,21 @@ public boolean equals(Object o)
         return false;
       }
       Expression that = (Expression) o;
-      return Objects.equals(expressionString, that.expressionString) && 
Objects.equals(outputType, that.outputType);
+      return Objects.equals(parsed.get().stringify(), 
that.parsed.get().stringify())

Review Comment:
   I spot checked a few `Expr` and they seems to have `equals` implemented, is 
there any reason to call `stringify` specifically? 



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