Rewrite zip joins into a form suitable for SQL using inner joins and RowNumber columns.
We rely on having a Bind around every Join and both of its generators, which should have been
generated by Phase.forceOuterBinds. The inner Binds need to select Pure(StructNode(...))
which should be the outcome of Phase.flattenProjections.
Attributes
rownumStyle
Whether to use Subquery boundaries suitable for Oracle-style ROWNUM
semantics instead of standard ROW_NUMBER().
Transform a zip operation of the form
Bind(s1, Join(jlsym, jrsym, l @ Bind(_, _, Pure(StructNode(ldefs), _)), r @ Bind(_, _, Pure(StructNode(rdefs), _)), JoinType.Zip, LiteralNode(true)), sel)
into an equivalent mapping operation using RowNum by first transforming both sides of the
join into zipWithIndex and then using transformZipWithIndex on those.
Transform a zip operation of the form
Bind(s1, Join(jlsym, jrsym, l @ Bind(_, _, Pure(StructNode(ldefs), _)), r @ Bind(_, _, Pure(StructNode(rdefs), _)), JoinType.Zip, LiteralNode(true)), sel)
into an equivalent mapping operation using RowNum by first transforming both sides of the
join into zipWithIndex and then using transformZipWithIndex on those.
Transform a zipWithIndex operation of the form
Bind(s1, Join(_, _, Bind(ls, from, Pure(StructNode(defs), _)), RangeFrom(offset), JoinType.Zip, LiteralNode(true)), p)
into an equivalent mapping operation using RowNum. This method can be overridden in
subclasses to implement non-standard translations.
Transform a zipWithIndex operation of the form
Bind(s1, Join(_, _, Bind(ls, from, Pure(StructNode(defs), _)), RangeFrom(offset), JoinType.Zip, LiteralNode(true)), p)
into an equivalent mapping operation using RowNum. This method can be overridden in
subclasses to implement non-standard translations.