| 97 | } |
| 98 | |
| 99 | RowVectorPtr GeneratorExplode::getOutput() { |
| 100 | if (!input_) { |
| 101 | return nullptr; |
| 102 | } |
| 103 | |
| 104 | auto size = input_->size(); |
| 105 | if (iterator_.rowOffset_ == 0) { |
| 106 | inputRows_.resize(size); |
| 107 | // process genInput |
| 108 | preGen(); |
| 109 | } |
| 110 | |
| 111 | // The max number of elements at each row across all generated columns. |
| 112 | auto maxSizes = AlignedBuffer::allocate<int64_t>(size, pool(), 0); |
| 113 | auto rawMaxSizes = maxSizes->asMutable<int64_t>(); |
| 114 | |
| 115 | std::vector<const vector_size_t*> rawSizes(1); |
| 116 | std::vector<const vector_size_t*> rawOffsets(1); |
| 117 | |
| 118 | int32_t channel = 0; |
| 119 | const auto& generateVector = genInput_[channel]; |
| 120 | |
| 121 | auto& currentDecoded = generateDecoded_[channel]; |
| 122 | auto currentIndices = currentDecoded.indices(); |
| 123 | |
| 124 | const ArrayVector* generateBaseArray; |
| 125 | const MapVector* generateBaseMap; |
| 126 | if (generateVector->typeKind() == TypeKind::ARRAY) { |
| 127 | generateBaseArray = currentDecoded.base()->as<ArrayVector>(); |
| 128 | rawSizes[channel] = generateBaseArray->rawSizes(); |
| 129 | rawOffsets[channel] = generateBaseArray->rawOffsets(); |
| 130 | } else { |
| 131 | BOLT_CHECK(generateVector->typeKind() == TypeKind::MAP); |
| 132 | generateBaseMap = currentDecoded.base()->as<MapVector>(); |
| 133 | rawSizes[channel] = generateBaseMap->rawSizes(); |
| 134 | rawOffsets[channel] = generateBaseMap->rawOffsets(); |
| 135 | } |
| 136 | |
| 137 | // Count max number of elements per row. |
| 138 | auto currentSizes = rawSizes[channel]; |
| 139 | int numElements = 0; |
| 140 | bool isIdentityMapping = true; |
| 141 | BufferPtr nulls = nullptr; |
| 142 | BufferPtr elementIndices = nullptr; |
| 143 | |
| 144 | if (isOuter_) { |
| 145 | calRepeatedCount<true>( |
| 146 | currentDecoded, |
| 147 | size, |
| 148 | currentSizes, |
| 149 | currentIndices, |
| 150 | rawMaxSizes, |
| 151 | numElements); |
| 152 | } else { |
| 153 | calRepeatedCount<false>( |
| 154 | currentDecoded, |
| 155 | size, |
| 156 | currentSizes, |
nothing calls this directly
no test coverage detected