本文整理匯總了Java中com.taobao.tddl.optimizer.core.ast.query.TableNode.executeOn方法的典型用法代碼示例。如果您正苦於以下問題:Java TableNode.executeOn方法的具體用法?Java TableNode.executeOn怎麽用?Java TableNode.executeOn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.taobao.tddl.optimizer.core.ast.query.TableNode
的用法示例。
在下文中一共展示了TableNode.executeOn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildMergeTableInOneDB
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
/**
* 構建單庫的執行節點
*/
private static OneDbNodeWithCount buildMergeTableInOneDB(TableNode table, TargetDB targetDB, int baseIndex,
boolean needCopy, boolean traceIn) {
long totalRowCount = 0;
OneDbNodeWithCount oneDbNodeWithCount = new OneDbNodeWithCount();
Map<String, Field> tabMap = targetDB.getTableNameMap();
int i = baseIndex;
for (String targetTable : tabMap.keySet()) {
TableNode node = table;
if (needCopy) {
node = table.copy();
// tddl的traceSource在分庫不分表,和全表掃描時無法使用 mengshi
if (traceIn && tabMap.get(targetTable) != null && tabMap.get(targetTable).getSourceKeys() != null) {
traceSourceInFilter(node.getKeyFilter(), tabMap.get(targetTable).getSourceKeys(), false);
traceSourceInFilter(node.getResultFilter(), tabMap.get(targetTable).getSourceKeys(), false);
}
}
if (needCopy) {
node.setActualTableName(targetTable);
node.executeOn(targetDB.getDbIndex());
node.setExtra(getIdentifierExtra((KVIndexNode) node, 0));// 設置標誌
oneDbNodeWithCount.subs.add(node);
} else {
node.setActualTableName(targetTable, i);
node.executeOn(targetDB.getDbIndex(), i);
node.setExtra(getIdentifierExtra((KVIndexNode) node, i), i);// 設置標誌
// 添加一個代理對象
oneDbNodeWithCount.subs.add((QueryTreeNode) new NodeDelegate(node, i).getProxy());
i = i + 1;
}
// 暫時先用邏輯表名,以後可能是索引名
String indexName = null;
if (node instanceof KVIndexNode) {
indexName = ((KVIndexNode) node).getKvIndexName();
} else {
indexName = node.getTableMeta().getPrimaryIndex().getName();
}
node.setBroadcast(OptimizerContext.getContext().getRule().isBroadCast(indexName));
totalRowCount += CostEsitimaterFactory.estimate(node).getRowCount();
}
oneDbNodeWithCount.totalRowCount = totalRowCount;
return oneDbNodeWithCount;
}
示例2: buildMergeTableInOneDB
import com.taobao.tddl.optimizer.core.ast.query.TableNode; //導入方法依賴的package包/類
/**
* 構建單庫的執行節點
*/
private static OneDbNodeWithCount buildMergeTableInOneDB(TableNode table, TargetDB targetDB, boolean needCopy) {
long totalRowCount = 0;
OneDbNodeWithCount oneDbNodeWithCount = new OneDbNodeWithCount();
Map<String, Field> tabMap = targetDB.getTableNameMap();
for (String targetTable : tabMap.keySet()) {
TableNode node = null;
if (needCopy) {
node = table.copy();
} else {
node = table;
}
// tddl的traceSource在分庫不分表,和全表掃描時無法使用 mengshi
if (tabMap.get(targetTable) != null && tabMap.get(targetTable).getSourceKeys() != null) {
if (node.getKeyFilter() != null) {
IFilter keyFilterAfterTraceSource = (IFilter) node.getKeyFilter().copy();
traceSourceInFilter(keyFilterAfterTraceSource, tabMap.get(targetTable).getSourceKeys());
node.setKeyFilter(keyFilterAfterTraceSource);
}
if (node.getResultFilter() != null) {
IFilter valueFilterAfterTraceSource = (IFilter) node.getResultFilter().copy();
traceSourceInFilter(valueFilterAfterTraceSource, tabMap.get(targetTable).getSourceKeys());
node.setResultFilter(valueFilterAfterTraceSource);
}
}
node.setActualTableName(targetTable);
node.executeOn(targetDB.getDbIndex());
node.setExtra(getIdentifierExtra((KVIndexNode) node));// 設置標誌
// 暫時先用邏輯表名,以後可能是索引名
String indexName = null;
if (node instanceof KVIndexNode) {
indexName = ((KVIndexNode) node).getKvIndexName();
} else {
indexName = node.getTableMeta().getPrimaryIndex().getName();
}
node.setBroadcast(OptimizerContext.getContext().getRule().isBroadCast(indexName));
totalRowCount += CostEsitimaterFactory.estimate(node).getRowCount();
oneDbNodeWithCount.subs.add(node);
}
oneDbNodeWithCount.totalRowCount = totalRowCount;
return oneDbNodeWithCount;
}