Fix checks

This commit is contained in:
kssenii 2021-04-21 19:53:38 +00:00
parent 473903b396
commit bb6bc61f22
3 changed files with 6 additions and 43 deletions

View File

@ -53,7 +53,7 @@ protected:
ContextPtr context_);
StorageExternalDistributed(
const String & uri,
const String & addresses_description,
const StorageID & table_id,
const String & format_name,
const std::optional<FormatSettings> & format_settings,

View File

@ -271,7 +271,7 @@ Pipe StorageURLWithFailover::read(
ConnectionTimeouts::getHTTPTimeouts(local_context),
chooseCompressionMethod(request_uri.getPath(), compression_method));
std::shuffle(uri_options.begin(), uri_options.begin(), thread_local_rng);
std::shuffle(uri_options.begin(), uri_options.end(), thread_local_rng);
return Pipe(url_source);
}
@ -321,9 +321,9 @@ StorageURLWithFailover::StorageURLWithFailover(
{
for (const auto & uri_option : uri_options_)
{
Poco::URI uri(uri_option);
context_->getRemoteHostFilter().checkURL(uri);
uri_options.emplace_back(std::move(uri));
Poco::URI uri_(uri_option);
context_->getRemoteHostFilter().checkURL(uri_);
uri_options.emplace_back(std::move(uri_));
LOG_DEBUG(&Poco::Logger::get("StorageURLDistributed"), "Adding URL option: {}", uri_option);
}
}

View File

@ -26,44 +26,7 @@ def test_url_without_redirect(started_cluster):
assert node1.query("select * from WebHDFSStorage") == "1\tMark\t72.53\n"
def test_url_with_globs_1(started_cluster):
query = "SELECT DISTINCT(users) FROM ("
for i in range (10, 20):
query += """
SELECT DISTINCT(users) FROM
(
SELECT JSONExtractString(data, 'actor', 'login') AS users,
JSONExtractString(data, 'payload', 'comment', 'body') AS body
FROM url('https://data.gharchive.org/2020-11-11-{}.json.gz', TSV, 'data String')
)
UNION ALL
""".format(i)
query += """
SELECT DISTINCT(users) FROM
(
SELECT JSONExtractString(data, 'actor', 'login') AS users,
JSONExtractString(data, 'payload', 'comment', 'body') AS body
FROM url('https://data.gharchive.org/2020-11-11-20.json.gz', TSV, 'data String')
)) ORDER BY users"""
expected = node1.query(query)
result = node1.query("""
SELECT DISTINCT(users) FROM
(
SELECT JSONExtractString(data, 'actor', 'login') AS users,
JSONExtractString(data, 'payload', 'comment', 'body') AS body
FROM url('https://data.gharchive.org/2020-11-11-{10..20}.json.gz', TSV, 'data String')
)
ORDER BY users;
""")
assert(result == expected)
def test_url_with_globs_2(started_cluster):
# 6 addresses
def test_url_with_globs(started_cluster):
started_cluster.hdfs_api.write_data("/simple_storage_1_1", "1\n")
started_cluster.hdfs_api.write_data("/simple_storage_1_2", "2\n")
started_cluster.hdfs_api.write_data("/simple_storage_1_3", "3\n")