mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #42223 from qoega/hdfs-empty-url
This commit is contained in:
commit
36b63badb3
@ -120,8 +120,15 @@ namespace
|
||||
|
||||
std::pair<String, String> getPathFromUriAndUriWithoutPath(const String & uri)
|
||||
{
|
||||
const size_t begin_of_path = uri.find('/', uri.find("//") + 2);
|
||||
return {uri.substr(begin_of_path), uri.substr(0, begin_of_path)};
|
||||
auto pos = uri.find("//");
|
||||
if (pos != std::string::npos && pos + 2 < uri.length())
|
||||
{
|
||||
pos = uri.find('/', pos + 2);
|
||||
if (pos != std::string::npos)
|
||||
return {uri.substr(pos), uri.substr(0, pos)};
|
||||
}
|
||||
|
||||
throw Exception("Storage HDFS requires valid URL to be set", ErrorCodes::BAD_ARGUMENTS);
|
||||
}
|
||||
|
||||
std::vector<String> getPathsList(const String & path_from_uri, const String & uri_without_path, ContextPtr context, std::unordered_map<String, time_t> * last_mod_times = nullptr)
|
||||
|
5
tests/queries/0_stateless/02458_empty_hdfs_url.sql
Normal file
5
tests/queries/0_stateless/02458_empty_hdfs_url.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- Tags: no-fasttest, no-cpu-aarch64
|
||||
SELECT * FROM hdfsCluster('test_shard_localhost', '', 'TSV'); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * FROM hdfsCluster('test_shard_localhost', ' ', 'TSV'); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * FROM hdfsCluster('test_shard_localhost', '/', 'TSV'); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT * FROM hdfsCluster('test_shard_localhost', 'http/', 'TSV'); -- { serverError BAD_ARGUMENTS }
|
Loading…
Reference in New Issue
Block a user