MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / InterpreterInsertQuery

Class InterpreterInsertQuery

src/Interpreters/InterpreterInsertQuery.h:21–91  ·  view source on GitHub ↗

Interprets the INSERT query. */

Source from the content-addressed store, hash-verified

19/** Interprets the INSERT query.
20 */
21class InterpreterInsertQuery : public IInterpreter, WithMutableContext
22{
23public:
24 InterpreterInsertQuery(
25 const ASTPtr & query_ptr_,
26 ContextMutablePtr context_,
27 bool allow_materialized_,
28 bool no_squash_,
29 bool no_destination,
30 bool async_insert_);
31
32 /** Prepare a request for execution. Return block streams
33 * - the stream into which you can write data to execute the query, if INSERT;
34 * - the stream from which you can read the result of the query, if SELECT and similar;
35 * Or nothing if the request INSERT SELECT (self-sufficient query - does not accept the input data, does not return the result).
36 */
37 BlockIO execute() override;
38
39 StorageID getDatabaseTable() const;
40
41 static void extendQueryLogElemImpl(QueryLogElement & elem, ContextPtr context_);
42
43 void extendQueryLogElemImpl(QueryLogElement & elem, const ASTPtr & ast, ContextPtr context_) const override;
44
45 StoragePtr getTable(ASTInsertQuery & query);
46
47 static Block getSampleBlock(
48 const ASTInsertQuery & query,
49 const StoragePtr & table,
50 const StorageMetadataPtr & metadata_snapshot,
51 ContextPtr context_,
52 bool no_destination = false,
53 bool allow_materialized = false);
54
55 bool supportsTransactions() const override { return true; }
56
57 static bool shouldAddSquashingForStorage(const StoragePtr & table, ContextPtr context);
58
59 static void setInsertContextValues(ContextMutablePtr context_, const ASTInsertQuery & insert_query, const StoragePtr & table);
60
61private:
62 static Block getSampleBlock(
63 const Names & names,
64 const StoragePtr & table,
65 const StorageMetadataPtr & metadata_snapshot,
66 bool allow_virtuals,
67 bool allow_materialized);
68
69 LoggerPtr logger;
70 ASTPtr query_ptr;
71 const bool allow_materialized;
72 bool no_squash = false;
73 bool no_destination = false;
74 const bool async_insert;
75 bool select_query_sorted = false;
76
77 size_t max_threads = 0;
78 size_t max_insert_threads = 0;

Callers 1

fillTableIfNeededMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected