2014-10-23 13:53:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
|
|
|
|
2021-02-09 08:37:55 +00:00
|
|
|
#include <memory>
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
2014-10-23 13:53:16 +00:00
|
|
|
|
|
|
|
|
2016-01-13 00:32:59 +00:00
|
|
|
namespace DB
|
2014-10-23 13:53:16 +00:00
|
|
|
{
|
|
|
|
|
2016-01-13 00:32:59 +00:00
|
|
|
class Block;
|
2017-12-25 21:57:29 +00:00
|
|
|
class NamesAndTypesList;
|
2020-10-02 12:38:50 +00:00
|
|
|
class ColumnsDescription;
|
2014-10-23 13:53:16 +00:00
|
|
|
|
2021-02-04 20:36:50 +00:00
|
|
|
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(
|
2021-02-04 20:36:50 +00:00
|
|
|
const Block & header,
|
2017-12-25 21:57:29 +00:00
|
|
|
const NamesAndTypesList & required_columns,
|
2020-10-02 12:38:50 +00:00
|
|
|
const ColumnsDescription & columns,
|
2021-04-23 09:50:56 +00:00
|
|
|
ContextPtr context,
|
|
|
|
bool save_unneeded_columns = true,
|
|
|
|
bool null_as_default = false);
|
2018-07-04 17:02:47 +00:00
|
|
|
|
2020-02-13 20:09:48 +00:00
|
|
|
/// Tries to convert columns in block to required_columns
|
2021-04-10 23:33:54 +00:00
|
|
|
void performRequiredConversions(Block & block, const NamesAndTypesList & required_columns, ContextPtr context);
|
|
|
|
|
2014-10-23 13:53:16 +00:00
|
|
|
}
|