| 256 | } |
| 257 | |
| 258 | std::unique_ptr<Value> ValueVector::getAsValue(uint64_t pos) const { |
| 259 | auto value = Value::createNullValue(dataType).copy(); |
| 260 | if (isNull(pos)) { |
| 261 | return value; |
| 262 | } |
| 263 | value->setNull(false); |
| 264 | value->dataType = dataType.copy(); |
| 265 | switch (dataType.getPhysicalType()) { |
| 266 | case PhysicalTypeID::INT64: { |
| 267 | value->val.int64Val = getValue<int64_t>(pos); |
| 268 | } break; |
| 269 | case PhysicalTypeID::INT32: { |
| 270 | value->val.int32Val = getValue<int32_t>(pos); |
| 271 | } break; |
| 272 | case PhysicalTypeID::INT16: { |
| 273 | value->val.int16Val = getValue<int16_t>(pos); |
| 274 | } break; |
| 275 | case PhysicalTypeID::INT8: { |
| 276 | value->val.int8Val = getValue<int8_t>(pos); |
| 277 | } break; |
| 278 | case PhysicalTypeID::UINT64: { |
| 279 | value->val.uint64Val = getValue<uint64_t>(pos); |
| 280 | } break; |
| 281 | case PhysicalTypeID::UINT32: { |
| 282 | value->val.uint32Val = getValue<uint32_t>(pos); |
| 283 | } break; |
| 284 | case PhysicalTypeID::UINT16: { |
| 285 | value->val.uint16Val = getValue<uint16_t>(pos); |
| 286 | } break; |
| 287 | case PhysicalTypeID::UINT8: { |
| 288 | value->val.uint8Val = getValue<uint8_t>(pos); |
| 289 | } break; |
| 290 | case PhysicalTypeID::INT128: { |
| 291 | value->val.int128Val = getValue<int128_t>(pos); |
| 292 | } break; |
| 293 | case PhysicalTypeID::DOUBLE: { |
| 294 | value->val.doubleVal = getValue<double>(pos); |
| 295 | } break; |
| 296 | case PhysicalTypeID::FLOAT: { |
| 297 | value->val.floatVal = getValue<float>(pos); |
| 298 | } break; |
| 299 | case PhysicalTypeID::BOOL: { |
| 300 | value->val.booleanVal = getValue<bool>(pos); |
| 301 | } break; |
| 302 | case PhysicalTypeID::INTERVAL: { |
| 303 | value->val.intervalVal = getValue<interval_t>(pos); |
| 304 | } break; |
| 305 | case PhysicalTypeID::STRING: |
| 306 | case PhysicalTypeID::JSON: { |
| 307 | value->strVal = getValue<string_t>(pos).getAsString(); |
| 308 | } break; |
| 309 | case PhysicalTypeID::ARRAY: |
| 310 | case PhysicalTypeID::LIST: { |
| 311 | auto dataVector = ListVector::getDataVector(this); |
| 312 | auto listEntry = getValue<list_entry_t>(pos); |
| 313 | std::vector<std::unique_ptr<Value>> children; |
| 314 | children.reserve(listEntry.size); |
| 315 | for (auto i = 0u; i < listEntry.size; ++i) { |
no test coverage detected