MCPcopy Create free account
hub / github.com/apache/impala / SetDecimalVal

Function SetDecimalVal

be/src/exec/data-source-scan-node.cc:306–340  ·  view source on GitHub ↗

Sets the decimal value in the slot. Inline method to avoid nested switch statements.

Source from the content-addressed store, hash-verified

304
305// Sets the decimal value in the slot. Inline method to avoid nested switch statements.
306inline 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
342Status DataSourceScanNode::MaterializeNextRow(const Timezone* local_tz,
343 MemPool* tuple_pool, Tuple* tuple) {

Callers 1

MaterializeNextRowMethod · 0.70

Calls 3

OKFunction · 0.85
GetByteSizeMethod · 0.80
StatusClass · 0.70

Tested by

no test coverage detected