| 192 | } |
| 193 | |
| 194 | void Tuple::ConvertOffsetsToPointers(const TupleDescriptor& desc, uint8_t* tuple_data) { |
| 195 | vector<SlotDescriptor*>::const_iterator slot = desc.string_slots().begin(); |
| 196 | for (; slot != desc.string_slots().end(); ++slot) { |
| 197 | DCHECK((*slot)->type().IsVarLenStringType()); |
| 198 | if (IsNull((*slot)->null_indicator_offset())) continue; |
| 199 | |
| 200 | StringValue* string_val = GetStringSlot((*slot)->tuple_offset()); |
| 201 | if (string_val->IsSmall()) continue; |
| 202 | int offset = reinterpret_cast<intptr_t>(string_val->Ptr()); |
| 203 | string_val->SetPtr(reinterpret_cast<char*>(tuple_data + offset)); |
| 204 | } |
| 205 | |
| 206 | slot = desc.collection_slots().begin(); |
| 207 | for (; slot != desc.collection_slots().end(); ++slot) { |
| 208 | DCHECK((*slot)->type().IsCollectionType()); |
| 209 | if (IsNull((*slot)->null_indicator_offset())) continue; |
| 210 | |
| 211 | CollectionValue* coll_value = GetCollectionSlot((*slot)->tuple_offset()); |
| 212 | int offset = reinterpret_cast<intptr_t>(coll_value->ptr); |
| 213 | coll_value->ptr = tuple_data + offset; |
| 214 | |
| 215 | uint8_t* coll_data = coll_value->ptr; |
| 216 | const TupleDescriptor& item_desc = *(*slot)->children_tuple_descriptor(); |
| 217 | for (int i = 0; i < coll_value->num_tuples; ++i) { |
| 218 | reinterpret_cast<Tuple*>(coll_data)->ConvertOffsetsToPointers( |
| 219 | item_desc, tuple_data); |
| 220 | coll_data += item_desc.byte_size(); |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | void Tuple::SetNullIndicators(NullIndicatorOffset offset, int64_t num_tuples, |
| 226 | int64_t tuple_stride, uint8_t* tuple_mem) { |
no test coverage detected