mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
feat: implicitly append wildcard if querying directory in file engine
This commit is contained in:
parent
e3f821573e
commit
be9a17f2cc
@ -366,12 +366,18 @@ Strings StorageFile::getPathsList(const String & table_path, const String & user
|
||||
}
|
||||
else if (path.find_first_of("*?{") == std::string::npos)
|
||||
{
|
||||
std::error_code error;
|
||||
size_t size = fs::file_size(path, error);
|
||||
if (!error)
|
||||
total_bytes_to_read += size;
|
||||
if (!fs::is_directory(path)) {
|
||||
std::error_code error;
|
||||
size_t size = fs::file_size(path, error);
|
||||
if (!error)
|
||||
total_bytes_to_read += size;
|
||||
|
||||
paths.push_back(path);
|
||||
paths.push_back(path);
|
||||
} else {
|
||||
/// We list non-directory files under that directory.
|
||||
paths = listFilesWithRegexpMatching(path / fs::path("*"), total_bytes_to_read);
|
||||
can_be_directory = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1,3 @@
|
||||
2
|
||||
2
|
||||
1
|
@ -0,0 +1,11 @@
|
||||
INSERT INTO FUNCTION file('data_03198_table_function_directory_path/1.csv', 'csv') SELECT '1.csv';
|
||||
INSERT INTO FUNCTION file('data_03198_table_function_directory_path/2.csv', 'csv') SELECT '2.csv';
|
||||
INSERT INTO FUNCTION file('data_03198_table_function_directory_path/dir/3.csv', 'csv') SELECT '3.csv';
|
||||
INSERT INTO FUNCTION file('data_03198_table_function_directory_path/dir1/dir/4.csv', 'csv') SELECT '4.csv';
|
||||
INSERT INTO FUNCTION file('data_03198_table_function_directory_path/dir2/dir/5.csv', 'csv') SELECT '5.csv';
|
||||
|
||||
SELECT COUNT(*) FROM file('data_03198_table_function_directory_path');
|
||||
SELECT COUNT(*) FROM file('data_03198_table_function_directory_path/');
|
||||
SELECT COUNT(*) FROM file('data_03198_table_function_directory_path/dir');
|
||||
SELECT COUNT(*) FROM file('data_03198_table_function_directory_path/*/dir', 'csv'); -- { serverError 74, 636 }
|
||||
SELECT COUNT(*) FROM file('data_03198_table_function_directory_pat'); -- { serverError 400 }
|
Loading…
Reference in New Issue
Block a user