提交 77ce9100 编写于 作者: A Amos Bird 提交者: alexey-milovidov

Fix invalid Context reference.

上级 7c07f46d
#include <IO/ReadHelpers.h>
#include <Interpreters/evaluateConstantExpression.h>
#include <Interpreters/Context.h>
#include <Interpreters/convertFieldToType.h>
#include <Parsers/TokenIterator.h>
#include <Parsers/ExpressionListParsers.h>
......@@ -29,8 +30,9 @@ namespace ErrorCodes
ValuesRowInputStream::ValuesRowInputStream(ReadBuffer & istr_, const Block & header_, const Context & context_, const FormatSettings & format_settings)
: istr(istr_), header(header_), context(context_), format_settings(format_settings)
: istr(istr_), header(header_), format_settings(format_settings)
{
context = std::make_unique<Context>(context_);
/// In this format, BOM at beginning of stream cannot be confused with value, so it is safe to skip it.
skipBOMIfExists(istr);
}
......@@ -112,7 +114,7 @@ bool ValuesRowInputStream::read(MutableColumns & columns)
istr.position() = const_cast<char *>(token_iterator->begin);
std::pair<Field, DataTypePtr> value_raw = evaluateConstantExpression(ast, context);
std::pair<Field, DataTypePtr> value_raw = evaluateConstantExpression(ast, *context);
Field value = convertFieldToType(value_raw.first, type, value_raw.second.get());
if (value.isNull())
......
......@@ -28,7 +28,7 @@ public:
private:
ReadBuffer & istr;
Block header;
const Context & context;
std::unique_ptr<Context> context;
const FormatSettings format_settings;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册