mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fixed parsing of floats in CSV file with custom delimiter #3142
This commit is contained in:
parent
8ba2ec9365
commit
c00147f37d
@ -3,6 +3,7 @@
|
||||
#include <Core/Defines.h>
|
||||
#include <common/shift10.h>
|
||||
#include <common/likely.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <double-conversion/double-conversion.h>
|
||||
|
||||
|
||||
@ -274,7 +275,7 @@ static inline void readUIntTextUpToNSignificantDigits(T & x, ReadBuffer & buf)
|
||||
{
|
||||
for (size_t i = 0; i < N; ++i)
|
||||
{
|
||||
if ((*buf.position() & 0xF0) == 0x30)
|
||||
if (isNumericASCII(*buf.position()))
|
||||
{
|
||||
x *= 10;
|
||||
x += *buf.position() & 0x0F;
|
||||
@ -284,14 +285,14 @@ static inline void readUIntTextUpToNSignificantDigits(T & x, ReadBuffer & buf)
|
||||
return;
|
||||
}
|
||||
|
||||
while (!buf.eof() && (*buf.position() & 0xF0) == 0x30)
|
||||
while (!buf.eof() && isNumericASCII(*buf.position()))
|
||||
++buf.position();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < N; ++i)
|
||||
{
|
||||
if (!buf.eof() && (*buf.position() & 0xF0) == 0x30)
|
||||
if (!buf.eof() && isNumericASCII(*buf.position()))
|
||||
{
|
||||
x *= 10;
|
||||
x += *buf.position() & 0x0F;
|
||||
@ -301,7 +302,7 @@ static inline void readUIntTextUpToNSignificantDigits(T & x, ReadBuffer & buf)
|
||||
return;
|
||||
}
|
||||
|
||||
while (!buf.eof() && (*buf.position() & 0xF0) == 0x30)
|
||||
while (!buf.eof() && isNumericASCII(*buf.position()))
|
||||
++buf.position();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ $ clickhouse-local --query="SELECT toString(rand64(1)) || toString(rand64(2)) ||
|
||||
|
||||
# Run test
|
||||
|
||||
$ for i in {1..10}; do echo $i; time ./read_float_perf < numbers$i.tsv; done
|
||||
$ for i in {1..10}; do echo $i; time ./read_float_perf 2 < numbers$i.tsv; done
|
||||
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user