mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Fix flattening of Array(Tuple(...)) #10259
This commit is contained in:
parent
4ecc86beca
commit
4cc0269de0
@ -86,7 +86,8 @@ Block flatten(const Block & block)
|
||||
{
|
||||
if (const DataTypeArray * type_arr = typeid_cast<const DataTypeArray *>(elem.type.get()))
|
||||
{
|
||||
if (const DataTypeTuple * type_tuple = typeid_cast<const DataTypeTuple *>(type_arr->getNestedType().get()))
|
||||
const DataTypeTuple * type_tuple = typeid_cast<const DataTypeTuple *>(type_arr->getNestedType().get());
|
||||
if (type_tuple && type_tuple->haveExplicitNames())
|
||||
{
|
||||
const DataTypes & element_types = type_tuple->getElements();
|
||||
const Strings & names = type_tuple->getElementNames();
|
||||
|
@ -17,6 +17,7 @@ namespace Nested
|
||||
std::string extractTableName(const std::string & nested_name);
|
||||
|
||||
/// Replace Array(Tuple(...)) columns to a multiple of Array columns in a form of `column_name.element_name`.
|
||||
/// only for named tuples that actually represent Nested structures.
|
||||
Block flatten(const Block & block);
|
||||
|
||||
/// Collect Array columns in a form of `column_name.element_name` to single Array(Tuple(...)) column.
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
/// TODO add ability to rename nested columns
|
||||
void rename(const String & column_from, const String & column_to);
|
||||
|
||||
/// NOTE Must correspond with Nested::flatten function.
|
||||
void flattenNested(); /// TODO: remove, insert already flattened Nested columns.
|
||||
|
||||
bool operator==(const ColumnsDescription & other) const { return columns == other.columns; }
|
||||
|
Loading…
Reference in New Issue
Block a user