dcapwell commented on code in PR #3995:
URL: https://github.com/apache/cassandra/pull/3995#discussion_r2004465282


##########
test/unit/org/apache/cassandra/cql3/ast/ExpressionEvaluator.java:
##########
@@ -21,126 +21,152 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
-import java.util.Optional;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
-import org.apache.cassandra.db.marshal.AbstractType;
+import javax.annotation.Nullable;
 
-import static java.util.Optional.of;
+import org.apache.cassandra.db.marshal.AbstractType;
 
 public class ExpressionEvaluator
 {
-    public static Optional<Object> tryEval(Expression e)
+    @Nullable
+    public static Object eval(Expression e)
     {
         if (e instanceof Value)
-            return of(((Value) e).value());
+            return ((Value) e).value();
         if (e instanceof TypeHint)
-            return tryEval(((TypeHint) e).e);
+            return eval(((TypeHint) e).e);
         if (e instanceof Operator)
-            return tryEval((Operator) e);
-        return Optional.empty();
+            return eval((Operator) e);
+        throw new UnsupportedOperationException("Unexpected expression type " 
+ e.getClass() + ": " + e.toCQL());
     }
 
-    public static Optional<Object> tryEval(Operator e)
+    @Nullable
+    public static Object eval(Operator e)
     {
+        Object lhs = eval(e.left);

Review Comment:
   the model `eval` method will put the "current" value as a `ByteBuffer` into 
the operation, this then means that the types might not match!  to solve this 
we just convert w/e we see a BB.



-- 
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: pr-unsubscr...@cassandra.apache.org

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


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

Reply via email to