@Test public void test_等于IN组合子查询_复杂条件_外部是个join节点() { TableNode table1 = new TableNode("TABLE1"); TableNode table2 = new TableNode("TABLE2"); JoinNode join = table1.join(table2, "ID", "ID"); join.query("TABLE1.ID = (SELECT ID FROM TABLE3 WHERE NAME = 'HELLO' AND SCHOOL = 'HELLO' ) AND TABLE1.NAME = 3 AND TABLE1.SCHOOL IN (SELECT SCHOOL FROM TABLE4)"); join.build(); QueryTreeNode qn = SubQueryPreProcessor.optimize(join); Assert.assertTrue(qn instanceof JoinNode); Assert.assertTrue(((JoinNode) qn).getLeftNode() instanceof JoinNode); Assert.assertTrue(((JoinNode) ((JoinNode) qn).getLeftNode()).getLeftNode() instanceof JoinNode); Assert.assertEquals(null, join.getWhereFilter()); }
public static QueryTreeNode optimize(QueryTreeNode qtn) throws QueryException { qtn = findComparisonsSubQueryToJoinNode(qtn); return qtn; }
SubQueryPreProcessor { public static QueryTreeNode optimize(QueryTreeNode qtn) throws QueryException { qtn = findComparisonsSubQueryToJoinNode(qtn); return qtn; } }
SubQueryPreProcessor { public static QueryTreeNode optimize(QueryTreeNode qtn) throws QueryException { qtn = findComparisonsSubQueryToJoinNode(qtn); return qtn; }  }
SubQueryPreProcessor { public static QueryTreeNode optimize(QueryTreeNode qtn) throws QueryException { qtn = findComparisonsSubQueryToJoinNode(qtn); return qtn; }  static QueryTreeNode optimize(QueryTreeNode qtn); }
SubQueryPreProcessor { public static QueryTreeNode optimize(QueryTreeNode qtn) throws QueryException { qtn = findComparisonsSubQueryToJoinNode(qtn); return qtn; }  static QueryTreeNode optimize(QueryTreeNode qtn);  }