aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/parseColumnsListForTableFunction.h
blob: ef1bbe5498eb16e9d34ac7acdf10e20dbfe3fa46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <string>
#include <Storages/ColumnsDescription.h>
#include <Core/Settings.h>


namespace DB
{

class Context;

struct DataTypeValidationSettings
{
    DataTypeValidationSettings() = default;

    explicit DataTypeValidationSettings(const Settings & settings)
        : allow_suspicious_low_cardinality_types(settings.allow_suspicious_low_cardinality_types)
        , allow_experimental_object_type(settings.allow_experimental_object_type)
        , allow_suspicious_fixed_string_types(settings.allow_suspicious_fixed_string_types)
    {
    }

    bool allow_suspicious_low_cardinality_types = true;
    bool allow_experimental_object_type = true;
    bool allow_suspicious_fixed_string_types = true;
};

void validateDataType(const DataTypePtr & type, const DataTypeValidationSettings & settings);

/// Parses a common argument for table functions such as table structure given in string
[[nodiscard]] ColumnsDescription parseColumnsListFromString(const std::string & structure, const ContextPtr & context);

bool tryParseColumnsListFromString(const std::string & structure, ColumnsDescription & columns, const ContextPtr & context, String & error);

}