| 52 | } |
| 53 | |
| 54 | Window::Window( |
| 55 | int32_t operatorId, |
| 56 | DriverCtx* driverCtx, |
| 57 | const std::shared_ptr<const core::WindowNode>& windowNode) |
| 58 | : Operator( |
| 59 | driverCtx, |
| 60 | windowNode->outputType(), |
| 61 | operatorId, |
| 62 | windowNode->id(), |
| 63 | "Window", |
| 64 | windowNode->inputsSorted() |
| 65 | ? (windowNode->canSpill(driverCtx->queryConfig()) |
| 66 | ? driverCtx->makeSpillConfig(operatorId) |
| 67 | : std::nullopt) |
| 68 | : (windowNode->canSpill(driverCtx->queryConfig()) |
| 69 | ? driverCtx->makeSpillConfig( |
| 70 | operatorId, |
| 71 | driverCtx->queryConfig().rowBasedSpillMode()) |
| 72 | : std::nullopt)), |
| 73 | numInputColumns_(windowNode->inputType()->size()), |
| 74 | stringAllocator_(pool()), |
| 75 | windowNode_(windowNode), |
| 76 | currentPartition_(nullptr) { |
| 77 | enableJit_ = driverCtx->queryConfig().enableJitRowCmpRow(); |
| 78 | const auto numPartitionKeys = windowNode->partitionKeys().size(); |
| 79 | const auto numSortingKeys = windowNode->sortingKeys().size(); |
| 80 | for (auto i = 0; i < numSortingKeys; ++i) { |
| 81 | sortKeyInfo_.push_back( |
| 82 | std::make_pair(numPartitionKeys + i, windowNode->sortingOrders()[i])); |
| 83 | } |
| 84 | |
| 85 | auto* spillConfig = |
| 86 | spillConfig_.has_value() ? &spillConfig_.value() : nullptr; |
| 87 | needSort_ = !(windowNode->inputsSorted()); |
| 88 | const auto windowBuildType = getWindowBuildType(); |
| 89 | const bool ignore = ignorePeer(); |
| 90 | const auto maxBatchRows = driverCtx->queryConfig().maxOutputBatchRows(); |
| 91 | const auto preferredBatchBytes = |
| 92 | driverCtx->queryConfig().preferredOutputBatchBytes(); |
| 93 | const auto spillThreshold = |
| 94 | operatorCtx_->driverCtx()->queryConfig().orderBySpillMemoryThreshold(); |
| 95 | |
| 96 | setWindowBuild( |
| 97 | windowBuildType, |
| 98 | spillConfig, |
| 99 | spillThreshold, |
| 100 | ignore, |
| 101 | maxBatchRows, |
| 102 | preferredBatchBytes); |
| 103 | } |
| 104 | |
| 105 | void Window::setRowsStreamingWindowBuild( |
| 106 | bool ignorePeer, |
nothing calls this directly
no test coverage detected