mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Check that position always advances
This commit is contained in:
parent
3b52b04008
commit
ee0ff755e2
@ -1719,7 +1719,7 @@ private:
|
||||
}
|
||||
// Remember where the data ended. We use this info later to determine
|
||||
// where the next query begins.
|
||||
parsed_insert_query->end = data_in.buffer().begin() + data_in.count();
|
||||
parsed_insert_query->end = parsed_insert_query->data + data_in.count();
|
||||
}
|
||||
else if (!is_interactive)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <IO/LimitReadBuffer.h>
|
||||
|
||||
#include <Common/Exception.h>
|
||||
|
||||
|
||||
@ -13,6 +14,8 @@ namespace ErrorCodes
|
||||
|
||||
bool LimitReadBuffer::nextImpl()
|
||||
{
|
||||
assert(position() >= in.position());
|
||||
|
||||
/// Let underlying buffer calculate read bytes in `next()` call.
|
||||
in.position() = position();
|
||||
|
||||
@ -25,7 +28,10 @@ bool LimitReadBuffer::nextImpl()
|
||||
}
|
||||
|
||||
if (!in.next())
|
||||
{
|
||||
working_buffer = in.buffer();
|
||||
return false;
|
||||
}
|
||||
|
||||
working_buffer = in.buffer();
|
||||
|
||||
|
@ -58,9 +58,9 @@ public:
|
||||
bytes += offset();
|
||||
bool res = nextImpl();
|
||||
if (!res)
|
||||
working_buffer.resize(0);
|
||||
|
||||
pos = working_buffer.begin() + nextimpl_working_buffer_offset;
|
||||
working_buffer = Buffer(pos, pos);
|
||||
else
|
||||
pos = working_buffer.begin() + nextimpl_working_buffer_offset;
|
||||
nextimpl_working_buffer_offset = 0;
|
||||
return res;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ private:
|
||||
const char * getName() const override { return "INSERT query"; }
|
||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||
public:
|
||||
ParserInsertQuery(const char * end_) : end(end_) {}
|
||||
explicit ParserInsertQuery(const char * end_) : end(end_) {}
|
||||
};
|
||||
|
||||
/** Insert accepts an identifier and an asterisk with variants.
|
||||
|
Loading…
Reference in New Issue
Block a user