在PrestoSqlDistributedExecutionPlanner.Visitor
中DynamicFilters
的函数是什么?
private Map<PlanNodeId, SplitSource> visitScanAndFilter(TableScanNode node, Optional<FilterNode> filter)
{
// ***What's the purpose of dynamicFilters and how to use it?***
List<DynamicFilters.Descriptor> dynamicFilters = filter
.map(FilterNode::getPredicate)
.map(expression -> extractDynamicFilters(metadata, expression))
.map(DynamicFilters.ExtractResult::getDynamicConjuncts)
.orElse(ImmutableList.of());
// TODO: Execution must be plugged in here
if (!dynamicFilters.isEmpty()) {
log.debug("Dynamic filters: %s", dynamicFilters);
}
// get dataSource for table
SplitSource splitSource = splitManager.getSplits(
session,
node.getTable(),
stageExecutionDescriptor.isScanGroupedExecution(node.getId()) ? GROUPED_SCHEDULING : UNGROUPED_SCHEDULING);
splitSources.add(splitSource);
return ImmutableMap.of(node.getId(), splitSource);
}
正如Martin所建议的,https://trino.io/blog/2019/06/30/dynamic-filtering.html描述了动态过滤器的含义。
代码中的TODO之所以存在,是因为还没有实现该功能的每一部分。你可以跟踪https://github.com/trino/presto/issues/52