diff --git a/dbms/src/IO/PeekableReadBuffer.cpp b/dbms/src/IO/PeekableReadBuffer.cpp index eff935a9de5..7c60bb252ad 100644 --- a/dbms/src/IO/PeekableReadBuffer.cpp +++ b/dbms/src/IO/PeekableReadBuffer.cpp @@ -19,7 +19,6 @@ bool PeekableReadBuffer::peekNext() { checkStateCorrect(); - size_t bytes_read = 0; Position copy_from = pos; size_t bytes_to_copy = sub_buf.available(); if (useSubbufferOnly()) @@ -27,11 +26,9 @@ bool PeekableReadBuffer::peekNext() /// Don't have to copy all data from sub-buffer if there is no data in own memory (checkpoint and pos are in sub-buffer) if (checkpoint) copy_from = checkpoint; - bytes_read = copy_from - sub_buf.buffer().begin(); bytes_to_copy = sub_buf.buffer().end() - copy_from; if (!bytes_to_copy) { - bytes += bytes_read; sub_buf.position() = copy_from; /// Both checkpoint and pos are at the end of sub-buffer. Just load next part of data. @@ -50,7 +47,6 @@ bool PeekableReadBuffer::peekNext() if (useSubbufferOnly()) { - bytes += bytes_read; sub_buf.position() = copy_from; } @@ -198,7 +194,6 @@ void PeekableReadBuffer::resizeOwnMemoryIfNecessary(size_t bytes_to_append) /// Move unread data to the beginning of own memory instead of resize own memory peeked_size -= offset; memmove(memory.data(), memory.data() + offset, peeked_size); - bytes += offset; if (need_update_checkpoint) checkpoint -= offset; diff --git a/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.reference b/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.reference new file mode 100644 index 00000000000..ae7a0f09264 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.reference @@ -0,0 +1 @@ +-160.32605 37.705841 diff --git a/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.sh b/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.sh new file mode 100755 index 00000000000..8e06e126f56 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01034_values_parse_float_bug.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + + +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS values_floats" + +${CLICKHOUSE_CLIENT} --query="CREATE TABLE values_floats (a Float32, b Float64) ENGINE = Memory" + +${CLICKHOUSE_CLIENT} --query="SELECT '(-160.32605134916085,37.70584056842162),' FROM numbers(1000000)" | ${CLICKHOUSE_CLIENT} --query="INSERT INTO values_floats FORMAT Values" + +${CLICKHOUSE_CLIENT} --query="SELECT DISTINCT round(a, 6), round(b, 6) FROM values_floats" + +${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS values_floats" +