Class BinaryOperationExpression

java.lang.Object
dev.frostlake.executor.expressions.BinaryOperationExpression
All Implemented Interfaces:
Expression

public class BinaryOperationExpression extends Object implements Expression
Represents a binary operation (e.g., a + b, x > 5, name = 'Alice')
  • Constructor Details

  • Method Details

    • getPosition

      public SourcePosition getPosition()
      Where the OPERATOR token sits — not the expression's start and not the enclosing select item's. An argument-type refusal is anchored here, which is what Snowflake points at: over SELECT bn || s AS c FROM t the refusal reads position 10, the offset of ||, and over SELECT n AS a, bn || s AS c FROM t it reads 18 — it tracks the operator through a longer prefix, a parenthesis, an enclosing call and a second select item alike (live-verified).
      Returns:
      the operator's position, or null where the expression was not built from a parse tree
    • setPosition

      public void setPosition(SourcePosition position)
    • isSimpleCaseTest

      public boolean isSimpleCaseTest()
      Whether this is the equality a simple CASE builds — CASE x WHEN v tests x = v, the subject on the left. Two collations that disagree there are named subject first, where a written comparison names its right side first (live-verified).
      Returns:
      true for a simple CASE's WHEN test
    • markSimpleCaseTest

      public void markSimpleCaseTest()
      Mark this equality as a simple CASE's WHEN test — see isSimpleCaseTest().
    • getLeft

      public Expression getLeft()
    • getRight

      public Expression getRight()
    • getOperator

      public BinaryOperator getOperator()
    • getEscape

      public Expression getEscape()
      The LIKE/ILIKE ESCAPE character expression, or null if the query had no ESCAPE clause.
    • accept

      public <T> T accept(ExpressionVisitor<T> visitor)
      Description copied from interface: Expression
      Accept a visitor for the visitor pattern
      Specified by:
      accept in interface Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object