@Test
public void requireSubqueryReplacement() throws IOException, RecognitionException {

    ProgramParser parser = new ProgramParser();
    OperatorNode<StatementOperator> program = parser.parse("program.yql",
            "SELECT * " +
                    "  FROM source1 WHERE id IN (SELECT id2 FROM source2);"
    );
    LogicalProgramTransforms transforms = new LogicalProgramTransforms();
    OperatorNode<StatementOperator> operator = transforms.apply(program, new ViewRegistry() {
        @Override
        public OperatorNode<SequenceOperator> getView(List<String> name) {
            return null;
        }
    });
    Assert.assertEquals(operator.toString(), "(PROGRAM L0:0 [(EXECUTE (EXTRACT {rowType=[source2]} (SCAN L53:1 {alias=source2, rowType=[source2]} [source2], []), (READ_FIELD L44:1 {rowType=[source2]} source2, id2)), subquery$0), (EXECUTE L0:1 (FILTER {rowType=[source1]} (SCAN L16:1 {alias=source1, rowType=[source1]} [source1], []), (IN (READ_FIELD L30:1 {rowType=[source1]} source1, id), (VARREF subquery$0))), result1), (OUTPUT L0:1 result1)])");
}