Class UnwrapSingleColumnRowInApply

java.lang.Object
io.trino.sql.planner.iterative.rule.UnwrapSingleColumnRowInApply
All Implemented Interfaces:
Rule<ApplyNode>

public class UnwrapSingleColumnRowInApply extends Object implements Rule<ApplyNode>
Given x::row(t) and y::row(t), converts assignments of the form

x IN (y...)</code> => <code>x[1] IN (y[1]...)

and

x <comparison> <quantifier> (y...) => x[1] <comparison> <quantifier> (y[1]...)

In particular, it transforms a plan with the following shape:


 - Apply x IN y
   - S [x :: row(T)]
   - Q [y :: row(T)]
 

into


 - Project (to preserve the outputs of Apply)
   - Apply x' IN y'
     - Project [x' :: T]
         x' = x[1]
       - S [x :: row(T)]
     - Project [y' :: T]
         y' = y[1]
       - Q [y :: row(T)]