*Update by @alexey-milovidov: to fix the issue, set `input_format_null_as_default` to 0 as it was in older versions.*

---


Clickhouse reports this when external dictionary not ends with "\n" and last column is empty:

```
root@clickhouse1:~# cat ~/passwd
metrika:x:1000:1000::/home/metrika:/bin/bash
clickhouse:x:106:108:Clickhouse server,,,:/nonexistent:
```

remove "\n" at the end of file, and then run query from documentation

```
# cat ~/passwd | sed 's/:/\t/g' | clickhouse-client --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String'
Code: 33, e.displayText() = DB::ParsingException: Unexpected end of stream, while parsing value of Nullable type: (at row 2)
: Buffer has gone, cannot extract information about what has been parsed., Stack trace (when copying this message, always include the lines below):

0. DB::ParsingException::ParsingException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x84dad27 in /usr/bin/clickhouse
1. bool DB::DataTypeNullable::deserializeTextEscaped<bool>(DB::IColumn&, DB::ReadBuffer&, DB::FormatSettings const&, std::__1::shared_ptr<DB::IDataType const> const&) @ 0xe74d65f in /usr/bin/clickhouse
2. DB::TabSeparatedRowInputFormat::readRow(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::RowReadExtension&) @ 0xf71dae9 in /usr/bin/clickhouse
3. DB::IRowInputFormat::generate() @ 0xf6904e8 in /usr/bin/clickhouse
4. DB::ISource::tryGenerate() @ 0xf61e8f5 in /usr/bin/clickhouse
5. DB::ISource::work() @ 0xf61e60a in /usr/bin/clickhouse
6. DB::ParallelParsingInputFormat::InternalParser::getChunk() @ 0xf6e6bee in /usr/bin/clickhouse
7. DB::ParallelParsingInputFormat::parserThreadFunction(std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0xf6e624e in /usr/bin/clickhouse
8. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x8513fb8 in /usr/bin/clickhouse
9. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()&&...)::'lambda'()::operator()() @ 0x8515f6f in /usr/bin/clickhouse
10. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x851158f in /usr/bin/clickhouse
11. ? @ 0x8515023 in /usr/bin/clickhouse
12. start_thread @ 0x76ba in /lib/x86_64-linux-gnu/libpthread-2.23.so
13. clone @ 0x10741d in /lib/x86_64-linux-gnu/libc-2.23.so
 (version 21.2.2.8 (official build))
Code: 33, e.displayText() = DB::ParsingException: Unexpected end of stream, while parsing value of Nullable type: (at row 2)
: Buffer has gone, cannot extract information about what has been parsed., Stack trace (when copying this message, always include the lines below):

0. DB::ParsingException::ParsingException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x84dad27 in /usr/bin/clickhouse
1. bool DB::DataTypeNullable::deserializeTextEscaped<bool>(DB::IColumn&, DB::ReadBuffer&, DB::FormatSettings const&, std::__1::shared_ptr<DB::IDataType const> const&) @ 0xe74d65f in /usr/bin/clickhouse
2. DB::TabSeparatedRowInputFormat::readRow(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::RowReadExtension&) @ 0xf71dae9 in /usr/bin/clickhouse
3. DB::IRowInputFormat::generate() @ 0xf6904e8 in /usr/bin/clickhouse
4. DB::ISource::tryGenerate() @ 0xf61e8f5 in /usr/bin/clickhouse
5. DB::ISource::work() @ 0xf61e60a in /usr/bin/clickhouse
6. DB::ParallelParsingInputFormat::InternalParser::getChunk() @ 0xf6e6bee in /usr/bin/clickhouse
7. DB::ParallelParsingInputFormat::parserThreadFunction(std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0xf6e624e in /usr/bin/clickhouse
8. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x8513fb8 in /usr/bin/clickhouse
9. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()&&...)::'lambda'()::operator()() @ 0x8515f6f in /usr/bin/clickhouse
10. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x851158f in /usr/bin/clickhouse
11. ? @ 0x8515023 in /usr/bin/clickhouse
12. start_thread @ 0x76ba in /lib/x86_64-linux-gnu/libpthread-2.23.so
13. clone @ 0x10741d in /lib/x86_64-linux-gnu/libc-2.23.so
 (version 21.2.2.8 (official build))
Code: 33. DB::ParsingException: Unexpected end of stream, while parsing value of Nullable type: (at row 2)
: Buffer has gone, cannot extract information about what has been parsed.: While executing SourceFromInputStream
```

{
    deserializeWholeTextImpl<void>(column, istr, settings, nested);
}
template <typename ReturnType>
ReturnType SerializationNullable::deserializeWholeTextImpl(IColumn & column, ReadBuffer & istr, const FormatSettings & settings,
                                                  const SerializationPtr & nested)
{
    return safeDeserialize<ReturnType>(column, *nested,
        [&istr]
        {
            return checkStringByFirstCharacterAndAssertTheRestCaseInsensitive("NULL", istr)
                || checkStringByFirstCharacterAndAssertTheRest("ᴺᵁᴸᴸ", istr);
        },
        [&nested, &istr, &settings] (IColumn & nested_column) { nested->deserializeWholeText(nested_column, istr, settings); });
}
void SerializationNullable::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings) const
{
    const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
    if (col.isNullAt(row_num))
        writeCString("\\N", ostr);
    else
        nested->serializeTextCSV(col.getNestedColumn(), row_num, ostr, settings);
}
void SerializationNullable::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const
{
    deserializeTextCSVImpl<void>(column, istr, settings, nested);
}
template<typename ReturnType>
ReturnType SerializationNullable::deserializeTextCSVImpl(IColumn & column, ReadBuffer & istr, const FormatSettings & settings,