| 1135 | } |
| 1136 | |
| 1137 | VectorPtr VectorFuzzer::fuzzComplex(const TypePtr& type, vector_size_t size) { |
| 1138 | ScopedOptions restorer(this); |
| 1139 | opts_.allowLazyVector = false; |
| 1140 | |
| 1141 | switch (type->kind()) { |
| 1142 | case TypeKind::ROW: |
| 1143 | return fuzzRow(std::dynamic_pointer_cast<const RowType>(type), size); |
| 1144 | |
| 1145 | case TypeKind::ARRAY: { |
| 1146 | const auto& elementType = type->asArray().elementType(); |
| 1147 | auto elementsLength = getElementsVectorLength(opts_, size); |
| 1148 | |
| 1149 | auto elements = opts_.containerHasNulls |
| 1150 | ? fuzz(elementType, elementsLength) |
| 1151 | : fuzzNotNull(elementType, elementsLength); |
| 1152 | return fuzzArray(elements, size); |
| 1153 | } |
| 1154 | |
| 1155 | case TypeKind::MAP: { |
| 1156 | // Do not initialize keys and values inline in the fuzzMap call as C++ |
| 1157 | // does not specify the order they'll be called in, leading to |
| 1158 | // inconsistent results across platforms. |
| 1159 | const auto& keyType = type->asMap().keyType(); |
| 1160 | const auto& valueType = type->asMap().valueType(); |
| 1161 | auto length = getElementsVectorLength(opts_, size); |
| 1162 | |
| 1163 | auto keys = opts_.normalizeMapKeys || !opts_.containerHasNulls |
| 1164 | ? fuzzNotNull(keyType, length) |
| 1165 | : fuzz(keyType, length); |
| 1166 | auto values = opts_.containerHasNulls ? fuzz(valueType, length) |
| 1167 | : fuzzNotNull(valueType, length); |
| 1168 | return fuzzMap(keys, values, size); |
| 1169 | } |
| 1170 | |
| 1171 | default: |
| 1172 | BOLT_UNREACHABLE("Unexpected type: {}", type->toString()); |
| 1173 | } |
| 1174 | return nullptr; // no-op. |
| 1175 | } |
| 1176 | |
| 1177 | VectorPtr VectorFuzzer::fuzzDictionary(const VectorPtr& vector) { |
| 1178 | return fuzzDictionary(vector, vector->size()); |
nothing calls this directly
no test coverage detected