Allow to insert from any format

This commit is contained in:
alesapin 2019-02-07 16:58:36 +03:00
parent 48bd750856
commit b0a77ff3f7

View File

@ -146,7 +146,11 @@ BlockIO InterpreterInsertQuery::execute()
else if (query.data)
{
auto data_in = std::make_unique<ReadBufferFromMemory>(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<OwningBlockInputStream<ReadBufferFromMemory>>(res.in, std::move(data_in));
res.in = std::make_shared<NullAndDoCopyBlockInputStream>(res.in, res.out);