mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #47410 from Avogar/fix-csv-big-numbers-inference
Fix big numbers inference in CSV
This commit is contained in:
commit
8c37540288
@ -984,13 +984,16 @@ DataTypePtr tryInferNumberFromString(std::string_view field, const FormatSetting
|
||||
if (tryReadIntText(tmp_int, buf) && buf.eof())
|
||||
return std::make_shared<DataTypeInt64>();
|
||||
|
||||
/// We can safely get back to the start of buffer, because we read from a string and we didn't reach eof.
|
||||
buf.position() = buf.buffer().begin();
|
||||
|
||||
/// In case of Int64 overflow, try to infer UInt64
|
||||
UInt64 tmp_uint;
|
||||
if (tryReadIntText(tmp_uint, buf) && buf.eof())
|
||||
return std::make_shared<DataTypeUInt64>();
|
||||
}
|
||||
|
||||
/// We cam safely get back to the start of buffer, because we read from a string and we didn't reach eof.
|
||||
/// We can safely get back to the start of buffer, because we read from a string and we didn't reach eof.
|
||||
buf.position() = buf.buffer().begin();
|
||||
|
||||
Float64 tmp;
|
||||
|
@ -0,0 +1,4 @@
|
||||
c1 Nullable(Float64)
|
||||
100000000000000000000
|
||||
c1 Nullable(Float64)
|
||||
-100000000000000000000
|
@ -0,0 +1,5 @@
|
||||
desc format('CSV', '100000000000000000000');
|
||||
select * from format('CSV', '100000000000000000000');
|
||||
desc format('CSV', '-100000000000000000000');
|
||||
select * from format('CSV', '-100000000000000000000');
|
||||
|
Loading…
Reference in New Issue
Block a user