ClickHouse/src/Interpreters/inplaceBlockConversions.h

49 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <Interpreters/Context_fwd.h>
#include <Common/COW.h>
2021-02-09 08:37:55 +00:00
#include <memory>
#include <string>
#include <unordered_map>
2016-01-13 00:32:59 +00:00
namespace DB
{
2016-01-13 00:32:59 +00:00
class Block;
class NamesAndTypesList;
2020-10-02 12:38:50 +00:00
class ColumnsDescription;
class IColumn;
using ColumnPtr = COW<IColumn>::Ptr;
using Columns = std::vector<ColumnPtr>;
struct StorageInMemoryMetadata;
using StorageMetadataPtr = std::shared_ptr<const StorageInMemoryMetadata>;
class ActionsDAG;
using ActionsDAGPtr = std::shared_ptr<ActionsDAG>;
2021-04-23 12:36:40 +00:00
/// Create actions which adds missing defaults to block according to required_columns using columns description
/// or substitute NULL into DEFAULT value in case of INSERT SELECT query (null_as_default) if according setting is 1.
2021-02-10 19:32:34 +00:00
/// Return nullptr if no actions required.
2021-02-05 15:11:26 +00:00
ActionsDAGPtr evaluateMissingDefaults(
const Block & header,
const NamesAndTypesList & required_columns,
2020-10-02 12:38:50 +00:00
const ColumnsDescription & columns,
ContextPtr context,
bool save_unneeded_columns = true,
bool null_as_default = false);
2020-02-13 20:09:48 +00:00
/// Tries to convert columns in block to required_columns
void performRequiredConversions(Block & block, const NamesAndTypesList & required_columns, ContextPtr context);
void fillMissingColumns(
Columns & res_columns,
size_t num_rows,
const NamesAndTypesList & requested_columns,
StorageMetadataPtr metadata_snapshot);
}