zinking commented on a change in pull request #1944:
URL: https://github.com/apache/calcite/pull/1944#discussion_r447663248



##########
File path: core/src/main/java/org/apache/calcite/plan/RelOptCost.java
##########
@@ -76,19 +132,28 @@
 
   /**
    * Compares this to another cost.
+   * This is based on the implementation of method {@link 
#compareCost(RelOptCost)},
+   *  and is not intended to be overridden.
    *
    * @param cost another cost
    * @return true iff this is less than or equal to other cost
    */
-  boolean isLe(RelOptCost cost);
+  default boolean isLe(RelOptCost cost) {
+    ComparisonResult result = compareCost(cost);
+    return result == ComparisonResult.LT || result == ComparisonResult.EQ;
+  }
 
   /**
    * Compares this to another cost.
+   * This is based on the implementation of method {@link 
#compareCost(RelOptCost)},
+   * and is not intended to be overridden.
    *
    * @param cost another cost
    * @return true iff this is strictly less than other cost
    */
-  boolean isLt(RelOptCost cost);
+  default boolean isLt(RelOptCost cost) {
+    return compareCost(cost) == ComparisonResult.LT;
+  }

Review comment:
       I don't see interface definition needs to be changed, the change should 
be made in the IMPlementation file.




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

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


Reply via email to