| 129 | } |
| 130 | |
| 131 | MapVectorPtr flattenMap( |
| 132 | const SelectivityVector& rows, |
| 133 | const VectorPtr& vector, |
| 134 | DecodedVector& decodedVector) { |
| 135 | if (decodedVector.isIdentityMapping()) { |
| 136 | return std::dynamic_pointer_cast<MapVector>(vector); |
| 137 | } |
| 138 | |
| 139 | auto newNumElements = countElements<MapVector>(rows, decodedVector); |
| 140 | |
| 141 | BufferPtr newNulls; |
| 142 | BufferPtr elementIndices; |
| 143 | BufferPtr newSizes; |
| 144 | BufferPtr newOffsets; |
| 145 | flattenBuffers<MapVector>( |
| 146 | rows, |
| 147 | newNumElements, |
| 148 | decodedVector, |
| 149 | newNulls, |
| 150 | elementIndices, |
| 151 | newSizes, |
| 152 | newOffsets); |
| 153 | |
| 154 | auto map = decodedVector.base()->as<MapVector>(); |
| 155 | return std::make_shared<MapVector>( |
| 156 | map->pool(), |
| 157 | map->type(), |
| 158 | newNulls, |
| 159 | rows.end(), |
| 160 | newOffsets, |
| 161 | newSizes, |
| 162 | BaseVector::wrapInDictionary( |
| 163 | BufferPtr(nullptr), elementIndices, newNumElements, map->mapKeys()), |
| 164 | BaseVector::wrapInDictionary( |
| 165 | BufferPtr(nullptr), |
| 166 | elementIndices, |
| 167 | newNumElements, |
| 168 | map->mapValues())); |
| 169 | } |
| 170 | |
| 171 | BufferPtr addNullsForUnselectedRows( |
| 172 | const VectorPtr& vector, |
no test coverage detected