Merge pull request #40746 from Avogar/fix-csv-schema-inference

Fix possible error Attempt to read after eof in CSV schema inference
This commit is contained in:
Kruglov Pavel 2022-08-31 18:29:01 +02:00 committed by GitHub
commit b7ea529307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -636,8 +636,9 @@ concept WithResize = requires (T value)
template <typename Vector>
void readCSVStringInto(Vector & s, ReadBuffer & buf, const FormatSettings::CSV & settings)
{
/// Empty string
if (buf.eof())
throwReadAfterEOF();
return;
const char delimiter = settings.delimiter;
const char maybe_quote = *buf.position();

View File

@ -0,0 +1,8 @@
c1 Nullable(String)
c2 Nullable(String)
c3 Nullable(String)
c4 Nullable(String)
c1 Nullable(Int64)
c2 Nullable(String)
c3 Nullable(String)
c4 Nullable(String)

View File

@ -0,0 +1,2 @@
desc format(CSV, ',,,');
desc format(CSV, '123,,abv,')