Package dev.frostlake.executor.operators
Class AsofJoinOperator
java.lang.Object
dev.frostlake.executor.operators.AsofJoinOperator
- All Implemented Interfaces:
Operator
Snowflake
ASOF JOIN: for every left row, the single CLOSEST right row that satisfies the
MATCH_CONDITION — the newest right row at or before the left row's timestamp, and the
mirror-image for the < / <= directions.
Live-verified semantics (probed against a real account):
- The result is LEFT OUTER: a left row with no qualifying right row survives, null-extended over the right table's columns.
>=/>pick the right row with the GREATEST match value among those satisfying the condition;<=/<pick the SMALLEST. Those four are the only operators Snowflake allows in a MATCH_CONDITION.- A NULL on either side of the comparison never matches, so such right rows are skipped.
- The optional
ON/USINGequality clause narrows the candidate set per left row (it partitions the join); without it every right row is a candidate.
-
Constructor Summary
ConstructorsConstructorDescriptionAsofJoinOperator(Table leftTable, Table rightTable, List<Row> rightRows, BinaryOperator matchOperator, Expression leftMatchExpression, RowExpressionEvaluator leftMatchEvaluator, Expression rightMatchExpression, RowExpressionEvaluator rightMatchEvaluator, JoinConditionEvaluator partitionEvaluator) -
Method Summary
Modifier and TypeMethodDescriptionexecute(List<Row> leftRows, OperatorContext context) Execute this operator on the input rows.Get a description of this operator for debugging/logging.
-
Constructor Details
-
AsofJoinOperator
public AsofJoinOperator(Table leftTable, Table rightTable, List<Row> rightRows, BinaryOperator matchOperator, Expression leftMatchExpression, RowExpressionEvaluator leftMatchEvaluator, Expression rightMatchExpression, RowExpressionEvaluator rightMatchEvaluator, JoinConditionEvaluator partitionEvaluator) - Parameters:
leftTable- left input metadatarightTable- right input metadatarightRows- the right input's rowsmatchOperator- the MATCH_CONDITION comparison (>=,>,<=,<)leftMatchExpression- the condition's left operand, evaluated against a LEFT rowleftMatchEvaluator- evaluator bound to the left inputrightMatchExpression- the condition's right operand, evaluated against a RIGHT rowrightMatchEvaluator- evaluator bound to the right inputpartitionEvaluator- the ON / USING equality test over a (left, right) pair, or null when absent
-
-
Method Details
-
execute
Description copied from interface:OperatorExecute this operator on the input rows. -
getDescription
Description copied from interface:OperatorGet a description of this operator for debugging/logging.- Specified by:
getDescriptionin interfaceOperator- Returns:
- A human-readable description of the operator
-