Class BinaryOperationExpression
java.lang.Object
dev.frostlake.executor.expressions.BinaryOperationExpression
- All Implemented Interfaces:
Expression
Represents a binary operation (e.g., a + b, x > 5, name = 'Alice')
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryOperationExpression(Expression left, BinaryOperator operator, Expression right) BinaryOperationExpression(Expression left, BinaryOperator operator, Expression right, Expression escape) -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(ExpressionVisitor<T> visitor) Accept a visitor for the visitor patternThe LIKE/ILIKEESCAPEcharacter expression, or null if the query had no ESCAPE clause.getLeft()Where the OPERATOR token sits — not the expression's start and not the enclosing select item's.getRight()booleanWhether this is the equality a simple CASE builds —CASE x WHEN vtestsx = v, the subject on the left.voidMark this equality as a simple CASE's WHEN test — seeisSimpleCaseTest().voidsetPosition(SourcePosition position) toString()
-
Constructor Details
-
BinaryOperationExpression
-
BinaryOperationExpression
public BinaryOperationExpression(Expression left, BinaryOperator operator, Expression right, Expression escape)
-
-
Method Details
-
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: overSELECT bn || s AS c FROM tthe refusal reads position 10, the offset of||, and overSELECT n AS a, bn || s AS c FROM tit 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
-
isSimpleCaseTest
public boolean isSimpleCaseTest()Whether this is the equality a simple CASE builds —CASE x WHEN vtestsx = 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 — seeisSimpleCaseTest(). -
getLeft
-
getRight
-
getOperator
-
getEscape
The LIKE/ILIKEESCAPEcharacter expression, or null if the query had no ESCAPE clause. -
accept
Description copied from interface:ExpressionAccept a visitor for the visitor pattern- Specified by:
acceptin interfaceExpression
-
toString
-