Print a collection (array or map), recursing through the children. Example: [(a 1) (b 2)]
| 167 | // Print a collection (array or map), recursing through the children. |
| 168 | // Example: [(a 1) (b 2)] |
| 169 | static void PrintCollection(const Tuple* t, const SlotDescriptor& slot_d, |
| 170 | stringstream* out) { |
| 171 | DCHECK(t != nullptr); |
| 172 | DCHECK(slot_d.type().IsCollectionType()); |
| 173 | const TupleDescriptor* child_tuple_d = slot_d.children_tuple_descriptor(); |
| 174 | const CollectionValue* coll_value = |
| 175 | reinterpret_cast<const CollectionValue*>(t->GetSlot(slot_d.tuple_offset())); |
| 176 | uint8_t* coll_buf = coll_value->ptr; |
| 177 | *out << "["; |
| 178 | for (int j = 0; j < coll_value->num_tuples; ++j) { |
| 179 | PrintTuple(reinterpret_cast<Tuple*>(coll_buf), *child_tuple_d, out); |
| 180 | coll_buf += child_tuple_d->byte_size(); |
| 181 | } |
| 182 | *out << "]"; |
| 183 | } |
| 184 | |
| 185 | // Print a struct with field names, recursing to children. This is not intended to work |
| 186 | // with impala_udf::StructVal. Instead, it works with the representation of structs |
no test coverage detected