Exemple #1
0
 @Test
 public void test_两表join_orderby_groupby_limit条件() {
   TableNode table = new TableNode("TABLE1");
   JoinNode join = table.join("TABLE2", "ID", "ID");
   join.select(
       OptimizerUtils.createColumnFromString("TABLE1.ID AS JID"),
       OptimizerUtils.createColumnFromString("CONCAT(TABLE1.NAME,TABLE1.SCHOOL) AS JNAME"));
   join.orderBy("JID");
   join.groupBy("JNAME");
   join.having("COUNT(JID) > 0");
   IQueryTree qc = (IQueryTree) optimizer.optimizeAndAssignment(join, null, extraCmd);
   Assert.assertTrue(qc instanceof IMerge);
   Assert.assertEquals(QUERY_CONCURRENCY.CONCURRENT, ((IMerge) qc).getQueryConcurrency()); // 串行
 }
Exemple #2
0
 @Test
 public void test_两表join_单独limit条件_不做并行() {
   TableNode table = new TableNode("TABLE1");
   JoinNode join = table.join("TABLE2", "ID", "ID");
   join.select(
       OptimizerUtils.createColumnFromString("TABLE1.ID AS JID"),
       OptimizerUtils.createColumnFromString("CONCAT(TABLE1.NAME,TABLE1.SCHOOL) AS JNAME"));
   join.limit(10, 20);
   IQueryTree qc = (IQueryTree) optimizer.optimizeAndAssignment(join, null, extraCmd);
   Assert.assertTrue(qc instanceof IMerge);
   Assert.assertEquals(QUERY_CONCURRENCY.SEQUENTIAL, ((IMerge) qc).getQueryConcurrency()); // 串行
   IJoin jn = (IJoin) ((IMerge) qc).getSubNodes().get(0);
   Assert.assertEquals("0", jn.getLimitFrom().toString());
   Assert.assertEquals("30", jn.getLimitTo().toString());
 }