Skip to content

Commit 8e30ae1

Browse files
committed
Corrections after review.
1 parent 5a67ff5 commit 8e30ae1

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/Storages/StorageFile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ std::pair<String, String> splitToArchivePathAndPathInArchive(const String & sour
285285
while (filename_view.starts_with(' '))
286286
filename_view.remove_prefix(1);
287287

288+
if (filename_view.empty() || path_to_archive_view.empty())
289+
return {{}, source};
290+
288291
/// possible situations when the first part can be archive is only if one of the following is true:
289-
/// - it contains supported extension
292+
/// - it contains supported archive extension
290293
/// - it contains characters that could mean glob expression
291-
if (filename_view.empty() || path_to_archive_view.empty()
292-
|| (!hasSupportedArchiveExtension(path_to_archive_view) && path_to_archive_view.find_first_of("*?{") == std::string_view::npos))
293-
{
294+
if (!hasSupportedArchiveExtension(path_to_archive_view) && path_to_archive_view.find_first_of("*?{") == std::string_view::npos)
294295
return {{}, source};
295-
}
296296

297297
return {String{path_to_archive_view}, String{filename_view}};
298298
}

src/TableFunctions/TableFunctionFile.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ std::optional<String> TableFunctionFile::tryGetFormatFromFirstArgument()
6666
if (fd >= 0)
6767
return FormatFactory::instance().tryGetFormatFromFileDescriptor(fd);
6868

69+
chassert(file_source); /// TableFunctionFile::parseFirstArguments() initializes either `fd` or `file_source`.
6970
return file_source->format_from_filenames;
7071
}
7172

@@ -95,6 +96,7 @@ StoragePtr TableFunctionFile::getStorage(
9596
if (fd >= 0)
9697
return std::make_shared<StorageFile>(fd, args);
9798

99+
chassert(file_source); /// TableFunctionFile::parseFirstArguments() initializes either `fd` or `file_source`.
98100
return std::make_shared<StorageFile>(*file_source, args);
99101
}
100102

@@ -105,7 +107,7 @@ ColumnsDescription TableFunctionFile::getActualTableStructure(ContextPtr context
105107
if (fd >= 0)
106108
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Schema inference is not supported for table function '{}' with file descriptor", getName());
107109

108-
chassert(file_source);
110+
chassert(file_source); /// TableFunctionFile::parseFirstArguments() initializes either `fd` or `file_source`.
109111

110112
ColumnsDescription columns;
111113
if (format == "auto")

0 commit comments

Comments
 (0)