@Test public void testInnerJoinWithSubqueryLHS() throws Exception { ResultSet rs = methodWatcher.executeQuery( format( "explain select a2.pid from (select person.pid from %s) as a3 " + " join %s a2 " + " on a2.pid = a3.pid ", spliceTableWatcher, spliceTableWatcher2)); int count = 0; while (rs.next()) { count++; if (count == 4) { String row = rs.getString(1); String joinStrategy = row.substring( row.indexOf(PLAN_LINE_LEADER) + PLAN_LINE_LEADER.length(), row.indexOf(JOIN_STRATEGY_TERMINATOR)); Assert.assertTrue( MERGE_SORT_JOIN.equals(joinStrategy) || BROADCAST_JOIN.equals(joinStrategy)); break; } } }
@Test public void testInnerJoinWithSubquery() throws Exception { ResultSet rs = methodWatcher.executeQuery( format( "explain select a2.pid from %s a2 join " + "(select person.pid from %s) as a3 " + " on a2.pid = a3.pid ", spliceTableWatcher2, spliceTableWatcher)); int count = 0; while (rs.next()) { count++; if (count == 4) { String row = rs.getString(1); String joinStrategy = row.substring( row.indexOf(PLAN_LINE_LEADER) + PLAN_LINE_LEADER.length(), row.indexOf(JOIN_STRATEGY_TERMINATOR)); Assert.assertThat( "Join strategy must be either MERGE_SORT_JOIN or BROADCAST_JOIN", joinStrategy, anyOf(equalTo(MERGE_SORT_JOIN), equalTo(BROADCAST_JOIN))); break; } } }