MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / flattenTupleLeafNames

Function flattenTupleLeafNames

src/DataTypes/NestedUtils.cpp:364–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364void flattenTupleLeafNames(const String & name, const DataTypePtr & type, Names & out)
365{
366 /// Mirrors the name generation of `flattenTupleRecursiveImpl`: descend only into flattenable
367 /// tuples, joining each element name onto the prefix, and emit non-tuple types as leaves.
368 const auto * tuple_type = tryGetFlattenableTuple(type);
369 if (!tuple_type)
370 {
371 out.push_back(name);
372 return;
373 }
374
375 const DataTypes & element_types = tuple_type->getElements();
376 const Strings & element_names = tuple_type->getElementNames();
377 for (size_t i = 0; i < element_types.size(); ++i)
378 flattenTupleLeafNames(concatenateName(name, element_names[i]), element_types[i], out);
379}
380
381/// Flatten tuple columns: input a vector of columns, return a new vector with all tuples expanded
382/// All tuples are flattened recursively

Calls 5

tryGetFlattenableTupleFunction · 0.85
concatenateNameFunction · 0.85
push_backMethod · 0.45
getElementsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected