MCPcopy Create free account
hub / github.com/bytedance/bolt / canPushdownFilters

Method canPushdownFilters

bolt/exec/Driver.cpp:1005–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005std::unordered_set<column_index_t> Driver::canPushdownFilters(
1006 const Operator* filterSource,
1007 const std::vector<column_index_t>& channels) const {
1008 int filterSourceIndex = -1;
1009 for (auto i = 0; i < operators_.size(); ++i) {
1010 auto op = operators_[i].get();
1011 if (filterSource == op) {
1012 filterSourceIndex = i;
1013 break;
1014 }
1015 }
1016 BOLT_CHECK_GE(
1017 filterSourceIndex,
1018 0,
1019 "Operator not found in its Driver: {}",
1020 filterSource->toString());
1021
1022 std::unordered_set<column_index_t> supportedChannels;
1023 for (auto i = 0; i < channels.size(); ++i) {
1024 auto channel = channels[i];
1025 for (auto j = filterSourceIndex - 1; j >= 0; --j) {
1026 auto prevOp = operators_[j].get();
1027
1028 if (j == 0) {
1029 // Source operator.
1030 if (prevOp->canAddDynamicFilter()) {
1031 supportedChannels.emplace(channels[i]);
1032 }
1033 break;
1034 }
1035
1036 const auto& identityProjections = prevOp->identityProjections();
1037 auto inputChannel = getIdentityProjection(identityProjections, channel);
1038 if (!inputChannel.has_value()) {
1039 // Filter channel is not an identity projection.
1040 if (prevOp->canAddDynamicFilter()) {
1041 supportedChannels.emplace(channels[i]);
1042 }
1043 break;
1044 }
1045
1046 // Continue walking upstream.
1047 channel = inputChannel.value();
1048 }
1049 }
1050
1051 return supportedChannels;
1052}
1053
1054Operator* Driver::findOperator(std::string_view planNodeId) const {
1055 for (auto& op : operators_) {

Callers 2

needsInputMethod · 0.80
asyncWaitForHashTableMethod · 0.80

Calls 8

getIdentityProjectionFunction · 0.85
has_valueMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45
canAddDynamicFilterMethod · 0.45
emplaceMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected