From b0a77ff3f715f4274dd669e520a0270f4fc4d5c0 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 7 Feb 2019 16:58:36 +0300 Subject: [PATCH] Allow to insert from any format --- dbms/src/Interpreters/InterpreterInsertQuery.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dbms/src/Interpreters/InterpreterInsertQuery.cpp b/dbms/src/Interpreters/InterpreterInsertQuery.cpp index 9ea67f84b28..4eef1720ef7 100644 --- a/dbms/src/Interpreters/InterpreterInsertQuery.cpp +++ b/dbms/src/Interpreters/InterpreterInsertQuery.cpp @@ -146,7 +146,11 @@ BlockIO InterpreterInsertQuery::execute() else if (query.data) { auto data_in = std::make_unique(query.data, query.end - query.data); - res.in = context.getInputFormat("Values", *data_in, table->getSampleBlock(), context.getSettingsRef().max_insert_block_size); + std::string format = "Values"; + if (!query.format.empty()) + format = query.format; + + res.in = context.getInputFormat(format, *data_in, table->getSampleBlock(), context.getSettingsRef().max_insert_block_size); res.in = std::make_shared>(res.in, std::move(data_in)); res.in = std::make_shared(res.in, res.out);