Class RexImplicationChecker

java.lang.Object
org.apache.calcite.plan.RexImplicationChecker

public class RexImplicationChecker extends Object
Checks whether one condition logically implies another.

If A ⇒ B, whenever A is true, B will be true also.

For example:

  • (x > 10) ⇒ (x > 5)
  • (x = 10) ⇒ (x < 30 OR y > 30)
  • (x = 10) ⇒ (x IS NOT NULL)
  • (x > 10 AND y = 20) ⇒ (x > 5)
  • Constructor Details

  • Method Details

    • implies

      public boolean implies(RexNode first, RexNode second)
      Checks if condition first implies (⇒) condition second.

      This reduces to SAT problem which is NP-Complete. When this method says first implies second then it is definitely true. But it cannot prove that first does not imply second.

      Parameters:
      first - first condition
      second - second condition
      Returns:
      true if it can prove first ⇒ second; otherwise false i.e., it doesn't know if implication holds