LocalExecutionPlanner.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:presto 作者:
/**
 * This method creates a mapping from each index source lookup symbol (directly applied to the index)
 * to the corresponding probe key Input
 */
private SetMultimap<Symbol, Integer> mapIndexSourceLookupSymbolToProbeKeyInput(IndexJoinNode node, Map<Symbol, Integer> probeKeyLayout)
{
    Set<Symbol> indexJoinSymbols = node.getCriteria().stream()
            .map(IndexJoinNode.EquiJoinClause::getIndex)
            .collect(toImmutableSet());

    // Trace the index join symbols to the index source lookup symbols
    // Map: Index join symbol => Index source lookup symbol
    Map<Symbol, Symbol> indexKeyTrace = IndexJoinOptimizer.IndexKeyTracer.trace(node.getIndexSource(), indexJoinSymbols);

    // Map the index join symbols to the probe key Input
    Multimap<Symbol, Integer> indexToProbeKeyInput = HashMultimap.create();
    for (IndexJoinNode.EquiJoinClause clause : node.getCriteria()) {
        indexToProbeKeyInput.put(clause.getIndex(), probeKeyLayout.get(clause.getProbe()));
    }

    // Create the mapping from index source look up symbol to probe key Input
    ImmutableSetMultimap.Builder<Symbol, Integer> builder = ImmutableSetMultimap.builder();
    for (Map.Entry<Symbol, Symbol> entry : indexKeyTrace.entrySet()) {
        Symbol indexJoinSymbol = entry.getKey();
        Symbol indexLookupSymbol = entry.getValue();
        builder.putAll(indexLookupSymbol, indexToProbeKeyInput.get(indexJoinSymbol));
    }
    return builder.build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号