2013-07-11 17:35:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-01-02 09:11:13 +00:00
|
|
|
#include <Core/Block.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
2013-07-11 17:35:56 +00:00
|
|
|
|
2015-10-04 03:17:36 +00:00
|
|
|
|
2013-07-11 17:35:56 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-12-25 18:58:39 +00:00
|
|
|
namespace Nested
|
2013-07-11 17:35:56 +00:00
|
|
|
{
|
2017-12-25 18:58:39 +00:00
|
|
|
std::string concatenateName(const std::string & nested_table_name, const std::string & nested_field_name);
|
|
|
|
|
2018-01-02 05:54:34 +00:00
|
|
|
std::pair<std::string, std::string> splitName(const std::string & name);
|
|
|
|
|
2017-04-17 11:56:55 +00:00
|
|
|
/// Returns the prefix of the name to the first '.'. Or the name is unchanged if there is no dot.
|
2017-12-25 18:58:39 +00:00
|
|
|
std::string extractTableName(const std::string & nested_name);
|
2013-08-14 16:52:40 +00:00
|
|
|
|
2017-12-25 21:10:46 +00:00
|
|
|
/// Replace Array(Tuple(...)) columns to a multiple of Array columns in a form of `column_name.element_name`.
|
2020-04-20 23:44:51 +00:00
|
|
|
/// only for named tuples that actually represent Nested structures.
|
2018-01-02 09:11:13 +00:00
|
|
|
Block flatten(const Block & block);
|
2017-12-25 21:10:46 +00:00
|
|
|
|
|
|
|
/// Collect Array columns in a form of `column_name.element_name` to single Array(Tuple(...)) column.
|
2017-12-25 21:57:29 +00:00
|
|
|
NamesAndTypesList collect(const NamesAndTypesList & names_and_types);
|
2018-09-12 21:08:55 +00:00
|
|
|
|
2020-12-07 19:02:26 +00:00
|
|
|
/// Convert old-style nested (single arrays with same prefix, `n.a`, `n.b`...) to subcolumns of data type Nested.
|
|
|
|
NamesAndTypesList convertToSubcolumns(const NamesAndTypesList & names_and_types);
|
|
|
|
|
2018-09-12 21:08:55 +00:00
|
|
|
/// Check that sizes of arrays - elements of nested data structures - are equal.
|
|
|
|
void validateArraySizes(const Block & block);
|
2018-08-10 04:02:56 +00:00
|
|
|
}
|
2013-07-11 17:35:56 +00:00
|
|
|
|
|
|
|
}
|