| 123 | } // namespace detail |
| 124 | |
| 125 | PartitionedOutput::PartitionedOutput( |
| 126 | int32_t operatorId, |
| 127 | DriverCtx* ctx, |
| 128 | const std::shared_ptr<const core::PartitionedOutputNode>& planNode, |
| 129 | bool eagerFlush) |
| 130 | : Operator( |
| 131 | ctx, |
| 132 | planNode->outputType(), |
| 133 | operatorId, |
| 134 | planNode->id(), |
| 135 | "PartitionedOutput"), |
| 136 | keyChannels_(toChannels(planNode->inputType(), planNode->keys())), |
| 137 | numDestinations_(planNode->numPartitions()), |
| 138 | replicateNullsAndAny_(planNode->isReplicateNullsAndAny()), |
| 139 | partitionFunction_( |
| 140 | numDestinations_ == 1 |
| 141 | ? nullptr |
| 142 | : planNode->partitionFunctionSpec().create(numDestinations_)), |
| 143 | outputChannels_(calculateOutputChannels( |
| 144 | planNode->inputType(), |
| 145 | planNode->outputType(), |
| 146 | planNode->outputType())), |
| 147 | bufferManager_(OutputBufferManager::getInstance()), |
| 148 | // NOTE: 'bufferReleaseFn_' holds a reference on the associated task to |
| 149 | // prevent it from deleting while there are output buffers being accessed |
| 150 | // out of the partitioned output buffer manager such as in Prestissimo, |
| 151 | // the http server holds the buffers while sending the data response. |
| 152 | bufferReleaseFn_([task = operatorCtx_->task()]() {}), |
| 153 | maxBufferedBytes_(ctx->task->queryCtx() |
| 154 | ->queryConfig() |
| 155 | .maxPartitionedOutputBufferSize()), |
| 156 | eagerFlush_(eagerFlush), |
| 157 | compressionKind_( |
| 158 | ctx->task->queryCtx()->queryConfig().isExchangeCompressionEnabled() |
| 159 | ? common::CompressionKind_ZSTD |
| 160 | : common::CompressionKind_NONE) { |
| 161 | if (!planNode->isPartitioned()) { |
| 162 | BOLT_USER_CHECK_EQ(numDestinations_, 1); |
| 163 | } |
| 164 | if (numDestinations_ == 1) { |
| 165 | BOLT_USER_CHECK(keyChannels_.empty()); |
| 166 | BOLT_USER_CHECK_NULL(partitionFunction_); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | void PartitionedOutput::initializeInput(RowVectorPtr input) { |
| 171 | input_ = std::move(input); |
nothing calls this directly
no test coverage detected