2021-04-23 23:56:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/Block.h>
|
|
|
|
#include <Core/NamesAndTypes.h>
|
2021-05-26 02:41:38 +00:00
|
|
|
#include <Common/FieldVisitors.h>
|
2021-07-23 16:30:18 +00:00
|
|
|
#include <Storages/ColumnsDescription.h>
|
2021-12-01 02:58:24 +00:00
|
|
|
#include <DataTypes/DataTypeTuple.h>
|
|
|
|
#include <DataTypes/Serializations/JSONDataParser.h>
|
2021-04-23 23:56:26 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-05-06 05:33:06 +00:00
|
|
|
size_t getNumberOfDimensions(const IDataType & type);
|
|
|
|
size_t getNumberOfDimensions(const IColumn & column);
|
2021-06-10 13:57:31 +00:00
|
|
|
DataTypePtr getBaseTypeOfArray(const DataTypePtr & type);
|
2021-05-06 05:33:06 +00:00
|
|
|
DataTypePtr createArrayOfType(DataTypePtr type, size_t dimension);
|
|
|
|
|
2021-12-23 12:28:40 +00:00
|
|
|
ColumnPtr getBaseColumnOfArray(const ColumnPtr & column);
|
|
|
|
ColumnPtr createArrayOfColumn(const ColumnPtr & column, size_t num_dimensions);
|
|
|
|
|
2021-04-23 23:56:26 +00:00
|
|
|
DataTypePtr getDataTypeByColumn(const IColumn & column);
|
2021-05-29 01:19:20 +00:00
|
|
|
void convertObjectsToTuples(NamesAndTypesList & columns_list, Block & block, const NamesAndTypesList & extended_storage_columns);
|
2021-12-01 02:58:24 +00:00
|
|
|
void checkObjectHasNoAmbiguosPaths(const Paths & paths);
|
2021-09-13 12:40:39 +00:00
|
|
|
DataTypePtr getLeastCommonTypeForObject(const DataTypes & types, bool check_ambiguos_paths = false);
|
2021-07-09 03:15:41 +00:00
|
|
|
NameSet getNamesOfObjectColumns(const NamesAndTypesList & columns_list);
|
2021-07-23 16:30:18 +00:00
|
|
|
void extendObjectColumns(NamesAndTypesList & columns_list, const ColumnsDescription & object_columns, bool with_subcolumns);
|
|
|
|
|
2021-12-01 02:58:24 +00:00
|
|
|
using DataTypeTuplePtr = std::shared_ptr<DataTypeTuple>;
|
|
|
|
|
|
|
|
std::pair<Paths, DataTypes> flattenTuple(const DataTypePtr & type);
|
|
|
|
|
|
|
|
DataTypePtr unflattenTuple(
|
|
|
|
const Paths & paths,
|
|
|
|
const DataTypes & tuple_types);
|
|
|
|
|
|
|
|
std::pair<DataTypePtr, ColumnPtr> unflattenTuple(
|
|
|
|
const Paths & paths,
|
|
|
|
const DataTypes & tuple_types,
|
|
|
|
const Columns & tuple_columns);
|
|
|
|
|
2021-07-23 16:30:18 +00:00
|
|
|
void replaceMissedSubcolumnsByConstants(
|
|
|
|
const ColumnsDescription & expected_columns,
|
|
|
|
const ColumnsDescription & available_columns,
|
|
|
|
ASTPtr query);
|
2021-07-09 03:15:41 +00:00
|
|
|
|
2021-06-12 15:10:25 +00:00
|
|
|
void finalizeObjectColumns(MutableColumns & columns);
|
2021-04-23 23:56:26 +00:00
|
|
|
|
|
|
|
}
|