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

Method CollectionElementToJSON

be/src/runtime/complex-value-writer.inline.h:145–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144template <class JsonStream>
145void ComplexValueWriter<JsonStream>::CollectionElementToJSON(Tuple* item_tuple,
146 const SlotDescriptor& slot_desc, bool map_key) {
147 void* element = item_tuple->GetSlot(slot_desc.tuple_offset());
148 DCHECK(element != nullptr);
149 const ColumnType& element_type = slot_desc.type();
150 bool element_is_null = item_tuple->IsNull(slot_desc.null_indicator_offset());
151 if (element_is_null) {
152 WriteNull(map_key);
153 } else if (element_type.IsStructType()) {
154 DCHECK(!map_key) << "Structs cannot be map keys.";
155 StructInCollectionToJSON(item_tuple, slot_desc);
156 } else if (element_type.IsCollectionType()) {
157 const CollectionValue* nested_collection_val =
158 reinterpret_cast<CollectionValue*>(element);
159 const TupleDescriptor* child_item_tuple_desc =
160 slot_desc.children_tuple_descriptor();
161 DCHECK(child_item_tuple_desc != nullptr);
162 ComplexValueWriter::CollectionValueToJSON(*nested_collection_val, element_type.type,
163 child_item_tuple_desc);
164 } else {
165 PrimitiveValueToJSON(element, element_type, map_key);
166 }
167}
168
169// Gets an array value and writes it in JSON format.
170template <class JsonStream>

Callers

nothing calls this directly

Calls 7

tuple_offsetMethod · 0.80
IsStructTypeMethod · 0.80
IsCollectionTypeMethod · 0.80
GetSlotMethod · 0.45
typeMethod · 0.45
IsNullMethod · 0.45

Tested by

no test coverage detected