yobx.sql.ops.join_op#

ONNX converter for JoinOp (SQL JOIN clause).

yobx.sql.ops.join_op.convert_join_op(g: GraphBuilder, sts: Dict | None, outputs: List[str], op: JoinOp, col_map: Dict[str, str], right_col_map: Dict[str, str]) Dict[str, str][source]#

Apply an equi-join between the left col_map and the right right_col_map.

Only inner-join semantics are implemented. One or more key column pairs can be specified via op.left_keys / op.right_keys; when multiple keys are given the match condition is the logical AND of all pairwise equalities.

For each left row the converter finds the first matching right row by broadcasting an equality check over both key tensors, then uses Compress (to drop non-matching left rows) and Gather (to align right-table rows with their matching left-table rows).

Parameters:
  • g – the graph builder to add ONNX nodes to.

  • sts – shape/type context dict (forwarded verbatim; may be empty).

  • outputs – expected output column names (keys of the returned col_map).

  • op – the JoinOp describing the join keys.

  • col_map – mapping from column name to current ONNX tensor name (left table).

  • right_col_map – same for the right table.

Returns:

a merged col_map containing all columns from both tables, aligned on the join key.