Sets the decimal value in the slot. Inline method to avoid nested switch statements.
| 304 | |
| 305 | // Sets the decimal value in the slot. Inline method to avoid nested switch statements. |
| 306 | inline Status SetDecimalVal(const ColumnType& type, char* bytes, int len, |
| 307 | void* slot) { |
| 308 | uint8_t* buffer = reinterpret_cast<uint8_t*>(bytes); |
| 309 | switch (type.GetByteSize()) { |
| 310 | case 4: { |
| 311 | Decimal4Value* val = reinterpret_cast<Decimal4Value*>(slot); |
| 312 | if (UNLIKELY(len > sizeof(Decimal4Value) || (ParquetPlainEncoder::Decode |
| 313 | <Decimal4Value, parquet::Type::FIXED_LEN_BYTE_ARRAY>(buffer, buffer + len, len, |
| 314 | val)) < 0)) { |
| 315 | return Status(ERROR_INVALID_DECIMAL); |
| 316 | } |
| 317 | break; |
| 318 | } |
| 319 | case 8: { |
| 320 | Decimal8Value* val = reinterpret_cast<Decimal8Value*>(slot); |
| 321 | if (UNLIKELY(len > sizeof(Decimal8Value) || (ParquetPlainEncoder::Decode |
| 322 | <Decimal8Value, parquet::Type::FIXED_LEN_BYTE_ARRAY>(buffer, buffer + len, len, |
| 323 | val)) < 0)) { |
| 324 | return Status(ERROR_INVALID_DECIMAL); |
| 325 | } |
| 326 | break; |
| 327 | } |
| 328 | case 16: { |
| 329 | Decimal16Value* val = reinterpret_cast<Decimal16Value*>(slot); |
| 330 | if (UNLIKELY(len > sizeof(Decimal16Value) || (ParquetPlainEncoder::Decode |
| 331 | <Decimal16Value, parquet::Type::FIXED_LEN_BYTE_ARRAY>(buffer, buffer + len, len, |
| 332 | val)) < 0)) { |
| 333 | return Status(ERROR_INVALID_DECIMAL); |
| 334 | } |
| 335 | break; |
| 336 | } |
| 337 | default: DCHECK(false); |
| 338 | } |
| 339 | return Status::OK(); |
| 340 | } |
| 341 | |
| 342 | Status DataSourceScanNode::MaterializeNextRow(const Timezone* local_tz, |
| 343 | MemPool* tuple_pool, Tuple* tuple) { |
no test coverage detected