```
SELECT
    _file,
    _path
FROM file('exists.csv', 'CSVWithNames')

Query id: 8bff0d32-cad0-4832-907a-be39f13ac49c


0 rows in set. Elapsed: 0.099 sec.

Received exception from server (version 22.7.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Invalid number of columns in chunk pushed to OutputPort. Expected 2, found 4
Header: _path LowCardinality(String) ColumnLowCardinality(size = 0, UInt8(size = 0), ColumnUnique(size = 1, String(size = 1))), _file LowCardinality(String) ColumnLowCardinality(size = 0, UInt8(size = 0), ColumnUnique(size = 1, String(size = 1)))
Chunk:  ColumnLowCardinality(size = 7385, UInt8(size = 7385), ColumnUnique(size = 1, String(size = 1))) ColumnLowCardinality(size = 7385, UInt8(size = 7385), ColumnUnique(size = 1, String(size = 1))) ColumnLowCardinality(size = 7385, UInt8(size = 7385), ColumnUnique(size = 2, String(size = 2))) ColumnLowCardinality(size = 7385, UInt8(size = 7385), ColumnUnique(size = 2, String(size = 2)))
. (LOGICAL_ERROR)
```

Version 22.7.1.2484

extern const int LOGICAL_ERROR;
    extern const int CANNOT_APPEND_TO_FILE;
    extern const int CANNOT_EXTRACT_TABLE_STRUCTURE;
}
namespace
{
/* Recursive directory listing with matched paths as a result.
 * Have the same method in StorageHDFS.
 */
void listFilesWithRegexpMatchingImpl(
    const std::string & path_for_ls,
    const std::string & for_match,
    size_t & total_bytes_to_read,
    std::vector<std::string> & result)
{
    const size_t first_glob = for_match.find_first_of("*?{");
    const size_t end_of_path_without_globs = for_match.substr(0, first_glob).rfind('/');
    const std::string suffix_with_globs = for_match.substr(end_of_path_without_globs);   
    const size_t next_slash = suffix_with_globs.find('/', 1);
    auto regexp = makeRegexpPatternFromGlobs(suffix_with_globs.substr(0, next_slash));
    re2::RE2 matcher(regexp);
    const std::string prefix_without_globs = path_for_ls + for_match.substr(1, end_of_path_without_globs);
    if (!fs::exists(prefix_without_globs))
        return;
    const fs::directory_iterator end;
    for (fs::directory_iterator it(prefix_without_globs); it != end; ++it)
    {
        const std::string full_path = it->path().string();
        const size_t last_slash = full_path.rfind('/');
        const String file_name = full_path.substr(last_slash);