| 518 | } |
| 519 | |
| 520 | DecimalVal SlotRef::GetDecimalValInterpreted( |
| 521 | ScalarExprEvaluator* eval, const TupleRow* row) const { |
| 522 | DCHECK_EQ(type_.type, TYPE_DECIMAL); |
| 523 | Tuple* t = row->GetTuple(tuple_idx_); |
| 524 | if (t == NULL || t->IsNull(null_indicator_offset_)) return DecimalVal::null(); |
| 525 | switch (type_.GetByteSize()) { |
| 526 | case 4: |
| 527 | return DecimalVal(*reinterpret_cast<int32_t*>(t->GetSlot(slot_offset_))); |
| 528 | case 8: |
| 529 | return DecimalVal(*reinterpret_cast<int64_t*>(t->GetSlot(slot_offset_))); |
| 530 | case 16: |
| 531 | // Avoid an unaligned load by using memcpy |
| 532 | __int128_t val; |
| 533 | memcpy(&val, t->GetSlot(slot_offset_), sizeof(val)); |
| 534 | return DecimalVal(val); |
| 535 | default: |
| 536 | DCHECK(false); |
| 537 | return DecimalVal::null(); |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | DateVal SlotRef::GetDateValInterpreted( |
| 542 | ScalarExprEvaluator* eval, const TupleRow* row) const { |
nothing calls this directly
no test coverage detected