wangshuo128 commented on code in PR #9506:
URL: https://github.com/apache/incubator-doris/pull/9506#discussion_r870355121


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ComparisonPredicate.java:
##########
@@ -18,42 +18,39 @@
 package org.apache.doris.nereids.trees.expressions;
 
 import org.apache.doris.nereids.exceptions.UnboundException;
-import org.apache.doris.nereids.trees.AbstractTreeNode;
 import org.apache.doris.nereids.trees.NodeType;
+import org.apache.doris.nereids.types.BooleanType;
 import org.apache.doris.nereids.types.DataType;
 
-import java.util.List;
-
 /**
- * Abstract class for all Expression in Nereids.
+ * Comparison predicate expression.
+ * Such as: "=", "!=", "<", "<=", ">", ">=", "<=>"
  */
-public abstract class AbstractExpression<EXPR_TYPE extends 
AbstractExpression<EXPR_TYPE>>
-        extends AbstractTreeNode<EXPR_TYPE>
-        implements Expression<EXPR_TYPE> {
-
-    public AbstractExpression(NodeType type, Expression... children) {
-        super(type, children);
-    }
-
-    public DataType getDataType() throws UnboundException {
-        throw new UnboundException("dataType");
-    }
-
-    public String sql() throws UnboundException {
-        throw new UnboundException("sql");
-    }
-
-    public boolean nullable() throws UnboundException {
-        throw new UnboundException("nullable");
+public class ComparisonPredicate<
+    LEFT_CHILD_TYPE extends Expression,
+    RIGHT_CHILD_TYPE extends Expression>
+    extends Expression<ComparisonPredicate<LEFT_CHILD_TYPE, RIGHT_CHILD_TYPE>>
+    implements BinaryExpression<ComparisonPredicate<LEFT_CHILD_TYPE, 
RIGHT_CHILD_TYPE>,
+    LEFT_CHILD_TYPE, RIGHT_CHILD_TYPE> {
+
+    /**
+     * Constructor of ComparisonPredicate.
+     *
+     * @param nodeType node type of expression
+     * @param left     left child of comparison predicate
+     * @param right    right child of comparison predicate
+     */
+    public ComparisonPredicate(NodeType nodeType, LEFT_CHILD_TYPE left, 
RIGHT_CHILD_TYPE right) {
+        super(nodeType, left, right);
     }
 
     @Override
-    public List<Expression> children() {
-        return (List) children;
+    public DataType getDataType() throws UnboundException {
+        return BooleanType.INSTANCE;
     }
 
     @Override
-    public Expression child(int index) {
-        return (Expression) children.get(index);
+    public String sql() {
+        return null;

Review Comment:
   Abstract class doesn't need to override this, right?



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