mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
add ** glob to hdfs docs
This commit is contained in:
parent
173f55989e
commit
97f1cfc232
@ -44,6 +44,7 @@ LIMIT 2
|
||||
Paths may use globbing. Files must match the whole path pattern, not only the suffix or prefix.
|
||||
|
||||
- `*` — Represents arbitrarily many characters except `/` but including the empty string.
|
||||
- `**` — Represents all files inside a folder recursively.
|
||||
- `?` — Represents an arbitrary single character.
|
||||
- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`. The strings can contain the `/` symbol.
|
||||
- `{N..M}` — Represents any number `>= N` and `<= M`.
|
||||
|
@ -81,6 +81,7 @@ SELECT * FROM file('test.csv', 'CSV', 'column1 UInt32, column2 UInt32, column3 U
|
||||
Обрабатываться будут те и только те файлы, которые существуют в файловой системе и удовлетворяют всему шаблону пути.
|
||||
|
||||
- `*` — заменяет любое количество любых символов кроме `/`, включая отсутствие символов.
|
||||
- `**` — Заменяет любое количество любых символов, включая `/`, то есть осуществляет рекурсивный поиск по вложенным директориям.
|
||||
- `?` — заменяет ровно один любой символ.
|
||||
- `{some_string,another_string,yet_another_one}` — заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. Эти строки также могут содержать символ `/`.
|
||||
- `{N..M}` — заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули).
|
||||
|
@ -47,6 +47,7 @@ LIMIT 2
|
||||
|
||||
|
||||
- `*` — Заменяет любое количество любых символов (кроме `/`), включая отсутствие символов.
|
||||
- `**` — Заменяет любое количество любых символов, включая `/`, то есть осуществляет рекурсивный поиск по вложенным директориям.
|
||||
- `?` — Заменяет ровно один любой символ.
|
||||
- `{some_string,another_string,yet_another_one}` — Заменяет любую из строк `'some_string', 'another_string', 'yet_another_one'`. Эти строки также могут содержать символ `/`.
|
||||
- `{N..M}` — Заменяет любое число в интервале от `N` до `M` включительно (может содержать ведущие нули).
|
||||
|
@ -61,6 +61,14 @@ def test_read_write_storage_with_globs(started_cluster):
|
||||
hdfs_api.write_data("/storage" + i, i + "\tMark\t72.53\n")
|
||||
assert hdfs_api.read_data("/storage" + i) == i + "\tMark\t72.53\n"
|
||||
|
||||
node1.query(
|
||||
"create table HDFSStorageWithDoubleAsterisk (id UInt32, name String, weight Float64) ENGINE = HDFS('hdfs://hdfs1:9000/**.tsv', 'TSV')"
|
||||
)
|
||||
|
||||
for i in ["1", "2", "3"]:
|
||||
hdfs_api.write_data(f"/subdir/file{i}.tsv", f"{i}\tMark\t72.53\n")
|
||||
assert hdfs_api.read_data(f"/subdir/file{i}.tsv") == f"{i}\tMark\t72.53\n"
|
||||
|
||||
assert (
|
||||
node1.query(
|
||||
"select count(*) from HDFSStorageWithRange settings s3_throw_on_zero_files_match=1"
|
||||
@ -70,6 +78,7 @@ def test_read_write_storage_with_globs(started_cluster):
|
||||
assert node1.query("select count(*) from HDFSStorageWithEnum") == "3\n"
|
||||
assert node1.query("select count(*) from HDFSStorageWithQuestionMark") == "3\n"
|
||||
assert node1.query("select count(*) from HDFSStorageWithAsterisk") == "3\n"
|
||||
assert node1.query("select count(*) from HDFSStorageWithDoubleAsterisk") == "3\n"
|
||||
|
||||
try:
|
||||
node1.query("insert into HDFSStorageWithEnum values (1, 'NEW', 4.2)")
|
||||
@ -92,6 +101,13 @@ def test_read_write_storage_with_globs(started_cluster):
|
||||
print(ex)
|
||||
assert "in readonly mode" in str(ex)
|
||||
|
||||
try:
|
||||
node1.query("insert into HDFSStorageWithDoubleAsterisk values (1, 'NEW', 4.2)")
|
||||
assert False, "Exception have to be thrown"
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
assert "in readonly mode" in str(ex)
|
||||
|
||||
|
||||
def test_storage_with_multidirectory_glob(started_cluster):
|
||||
hdfs_api = started_cluster.hdfs_api
|
||||
|
Loading…
Reference in New Issue
Block a user