ClickHouse/src/Interpreters/addMissingDefaults.h

31 lines
992 B
C++
Raw Normal View History

#pragma once
#include <Interpreters/Context_fwd.h>
2021-02-08 12:52:30 +00:00
#include <memory>
#include <string>
#include <unordered_map>
namespace DB
{
class Block;
class NamesAndTypesList;
2020-10-02 12:38:50 +00:00
class ColumnsDescription;
2021-02-05 11:41:44 +00:00
class ActionsDAG;
using ActionsDAGPtr = std::shared_ptr<ActionsDAG>;
/** Adds three types of columns into block
* 1. Columns, that are missed inside request, but present in table without defaults (missed columns)
* 2. Columns, that are missed inside request, but present in table with defaults (columns with default values)
* 3. Columns that materialized from other columns (materialized columns)
2021-04-23 19:08:13 +00:00
* Also can substitute NULL with DEFAULT value in case of INSERT SELECT query (null_as_default) if according setting is 1.
* All three types of columns are materialized (not constants).
*/
2021-02-05 11:41:44 +00:00
ActionsDAGPtr addMissingDefaults(
const Block & header, const NamesAndTypesList & required_columns,
const ColumnsDescription & columns, ContextPtr context, bool null_as_default = false);
}