本文整理汇总了Java中com.taobao.tddl.optimizer.core.ast.query.MergeNode.select方法的典型用法代码示例。如果您正苦于以下问题:Java MergeNode.select方法的具体用法?Java MergeNode.select怎么用?Java MergeNode.select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.taobao.tddl.optimizer.core.ast.query.MergeNode
的用法示例。
在下文中一共展示了MergeNode.select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertPlanToAst
import com.taobao.tddl.optimizer.core.ast.query.MergeNode; //导入方法依赖的package包/类
public static MergeNode convertPlanToAst(IMerge merge) {
MergeNode node = new MergeNode();
for (IDataNodeExecutor plan : merge.getSubNodes()) {
if (!(plan instanceof IQueryTree)) {
throw new OptimizerException("不支持将非merge(query)转为语法树");
}
node.addChild(convertPlanToAst((IQueryTree) plan));
}
node.setLimitFrom(merge.getLimitFrom());
node.setLimitTo(merge.getLimitTo());
node.select(merge.getColumns());
node.setAlias(merge.getAlias());
node.setSubQuery(merge.isSubQuery());
node.setUnion(merge.isUnion());
node.setOrderBys(merge.getOrderBys());
node.setLimitFrom(merge.getLimitFrom());
node.setLimitTo(merge.getLimitTo());
node.setGroupBys(merge.getGroupBys());
node.setSharded(merge.isSharded());
node.having(merge.getHavingFilter());
node.setOtherJoinOnFilter(merge.getOtherJoinOnFilter());
node.setExistAggregate(merge.isExistAggregate());
node.setGroupByShardColumns(merge.isGroupByShardColumns());
node.setDistinctByShardColumns(merge.isDistinctByShardColumns());
node.executeOn(merge.getDataNode());
node.setSubqueryOnFilterId(merge.getSubqueryOnFilterId());
node.setSubqueryFilter(merge.getSubqueryFilter());
node.build();
node = node.deepCopy();
return node;
}
示例2: TableNode
import com.taobao.tddl.optimizer.core.ast.query.MergeNode; //导入方法依赖的package包/类
@Test
public void test_merge的distinct下推() {
TableNode table1 = new TableNode("TABLE1");
TableNode table2 = new TableNode("TABLE2");
IColumn id = ASTNodeFactory.getInstance().createColumn();
id.setColumnName("ID");
id.setDistinct(true);
IColumn name = ASTNodeFactory.getInstance().createColumn();
name.setColumnName("NAME");
name.setDistinct(true);
IColumn school = ASTNodeFactory.getInstance().createColumn();
school.setColumnName("SCHOOL");
school.setDistinct(true);
table1.groupBy("NAME");
table1.orderBy("ID");
MergeNode merge = table1.merge(table2);
merge.select(id, name, school);
merge.build();
OrderByPusher.optimize(merge);
Assert.assertEquals(3, table1.getOrderBys().size());
Assert.assertEquals("TABLE1.NAME", table1.getOrderBys().get(0).getColumn().toString());
}