当前位置: 首页>>代码示例>>Java>>正文


Java JoinNode.query方法代码示例

本文整理汇总了Java中com.taobao.tddl.optimizer.core.ast.query.JoinNode.query方法的典型用法代码示例。如果您正苦于以下问题:Java JoinNode.query方法的具体用法?Java JoinNode.query怎么用?Java JoinNode.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taobao.tddl.optimizer.core.ast.query.JoinNode的用法示例。


在下文中一共展示了JoinNode.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TableNode

import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //导入方法依赖的package包/类
@Test
public void test_where条件下推_多级join() {
    TableNode table1 = new TableNode("TABLE1");
    TableNode table2 = new TableNode("TABLE2");
    TableNode table3 = new TableNode("TABLE3");

    JoinNode join = table1.join(table2);
    join.select("TABLE1.ID AS ID , TABLE1.NAME AS NAME");
    join.query("TABLE1.ID>5 AND TABLE2.ID<10 AND TABLE1.NAME = TABLE2.NAME");
    join.build();

    JoinNode nextJoin = join.join(table3);
    nextJoin.query("TABLE1.NAME = 6 AND TABLE1.ID = TABLE3.ID");
    nextJoin.build();
    FilterPusher.optimize(nextJoin);

    Assert.assertEquals("(TABLE1.NAME = 6 AND TABLE1.ID > 5)", ((JoinNode) nextJoin.getLeftNode()).getLeftNode()
        .getWhereFilter()
        .toString());
    Assert.assertEquals("(TABLE2.ID < 10 AND TABLE2.NAME = 6)", ((JoinNode) nextJoin.getLeftNode()).getRightNode()
        .getWhereFilter()
        .toString());
    Assert.assertEquals("TABLE1.ID = TABLE3.ID", nextJoin.getJoinFilter().get(0).toString());
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:25,代码来源:FilterPusherTest.java

示例2: TableNode

import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //导入方法依赖的package包/类
@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());
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:15,代码来源:SubQueryPreProcessorTest.java

示例3: TableNode

import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //导入方法依赖的package包/类
@Test
public void test_两表Join_二级索引_存在二级索引条件() {
    TableNode table = new TableNode("TABLE1");
    JoinNode join = table.join("TABLE2", "NAME", "NAME");
    join.query("TABLE2.NAME = 1");
    IQueryTree qc = (IQueryTree) optimizer.optimizeAndAssignment(join, null, extraCmd);
    Assert.assertTrue(qc instanceof IJoin);
    Assert.assertTrue(((IJoin) qc).getLeftNode() instanceof IJoin);
    Assert.assertTrue(((IJoin) qc).getRightNode() instanceof IMerge);
    Assert.assertEquals(JoinStrategy.INDEX_NEST_LOOP, ((IJoin) qc).getJoinStrategy());
    IJoin subJoin = (IJoin) ((IJoin) qc).getLeftNode();
    Assert.assertTrue(((IJoin) subJoin).getLeftNode() instanceof IMerge);
    Assert.assertTrue(((IJoin) subJoin).getRightNode() instanceof IMerge);
    Assert.assertEquals(JoinStrategy.INDEX_NEST_LOOP, subJoin.getJoinStrategy());
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:16,代码来源:OptimizerTest.java

示例4: TableNode

import com.taobao.tddl.optimizer.core.ast.query.JoinNode; //导入方法依赖的package包/类
@Test
public void test_两表Join_主键索引_存在主键索引条件() {
    TableNode table = new TableNode("TABLE1");
    JoinNode join = table.join("TABLE2", "ID", "ID");
    join.query("TABLE2.ID IN (1,2)");
    IQueryTree qc = (IQueryTree) optimizer.optimizeAndAssignment(join, null, extraCmd);
    Assert.assertTrue(qc instanceof IMerge);
    Assert.assertTrue(((IMerge) qc).getSubNode().get(0) instanceof IJoin);
    IJoin subJoin = (IJoin) ((IMerge) qc).getSubNode().get(0);
    Assert.assertEquals(JoinStrategy.INDEX_NEST_LOOP, subJoin.getJoinStrategy());
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:12,代码来源:OptimizerTest.java


注:本文中的com.taobao.tddl.optimizer.core.ast.query.JoinNode.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。