| 41 | namespace bytedance::bolt::exec { |
| 42 | |
| 43 | SortWindowBuild::SortWindowBuild( |
| 44 | const std::shared_ptr<const core::WindowNode>& node, |
| 45 | bolt::memory::MemoryPool* pool, |
| 46 | const common::SpillConfig* spillConfig, |
| 47 | tsan_atomic<bool>* nonReclaimableSection, |
| 48 | uint64_t spillMemoryThreshold, |
| 49 | bool enableJit) |
| 50 | : WindowBuild( |
| 51 | node, |
| 52 | pool, |
| 53 | spillConfig, |
| 54 | nonReclaimableSection, |
| 55 | spillMemoryThreshold, |
| 56 | enableJit), |
| 57 | pool_(pool), |
| 58 | comparator_(sortKeyInfo_, data_.get()) { |
| 59 | BOLT_CHECK_NOT_NULL(pool_); |
| 60 | allKeyInfo_.reserve(partitionKeyInfo_.size() + sortKeyInfo_.size()); |
| 61 | allKeyInfo_.insert( |
| 62 | allKeyInfo_.cend(), partitionKeyInfo_.begin(), partitionKeyInfo_.end()); |
| 63 | allKeyInfo_.insert( |
| 64 | allKeyInfo_.cend(), sortKeyInfo_.begin(), sortKeyInfo_.end()); |
| 65 | partitionStartRows_.resize(0); |
| 66 | followedTopNum_ = node->followedTopNum(); |
| 67 | if (followedTopNum_ > 0) { |
| 68 | if (numPartitionKeys_ > 0) { |
| 69 | Accumulator accumulator{ |
| 70 | true, |
| 71 | sizeof(TopRows), |
| 72 | false, |
| 73 | 1, |
| 74 | nullptr, |
| 75 | nullptr, |
| 76 | [](auto, auto) { BOLT_UNREACHABLE(); }, |
| 77 | [](auto, auto) { BOLT_UNREACHABLE(); }, |
| 78 | [](auto) {}}; |
| 79 | |
| 80 | table_ = std::make_unique<HashTable<false>>( |
| 81 | createVectorHashers(node->inputType(), node->partitionKeys()), |
| 82 | std::vector<Accumulator>{accumulator}, |
| 83 | std::vector<TypePtr>{}, |
| 84 | false, // allowDuplicates |
| 85 | false, // isJoinBuild |
| 86 | false, // hasProbedFlag |
| 87 | 0, // minTableSizeForParallelJoinBuild |
| 88 | pool_, |
| 89 | nullptr, |
| 90 | false); |
| 91 | partitionOffset_ = |
| 92 | table_->rows()->columnAt(node->partitionKeys().size()).offset(); |
| 93 | lookup_ = std::make_unique<HashLookup>(table_->hashers()); |
| 94 | } else { |
| 95 | allocator_ = std::make_unique<HashStringAllocator>(pool_); |
| 96 | singlePartition_ = |
| 97 | std::make_unique<TopRows>(allocator_.get(), comparator_); |
| 98 | } |
| 99 | } |
| 100 | } |
nothing calls this directly
no test coverage detected