ClickHouse/docs/ja/engines/table-engines/integrations/hdfs.md

124 lines
4.3 KiB
Markdown
Raw Normal View History

2020-04-04 09:15:31 +00:00
---
machine_translated: true
machine_translated_rev: 72537a2d527c63c07aa5d2361a8829f3895cf2bd
2020-04-04 09:15:31 +00:00
toc_priority: 36
toc_title: HDFS
---
# HDFS {#table_engines-hdfs}
このエンジンは、 [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) 生態系および管理データ [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)クリックハウス経由。 このエンジンは同様です
DOCS-624: Fixing links to nowhere (#10675) * enbaskakova-DOCSUP-652 (#101) * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" * Update docs/en/sql_reference/aggregate_functions/combinators.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/sql_reference/aggregate_functions/combinators.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/sql_reference/aggregate_functions/combinators.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/sql_reference/aggregate_functions/combinators.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * Update docs/en/sql_reference/aggregate_functions/combinators.md Co-Authored-By: BayoNet <da-daos@yandex.ru> * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" * "docs(orNull&orDefault): Functions 'orNull&orDefault' have been edited" Co-authored-by: elenbaskakova <elenbaskakova@yandex-team.ru> Co-authored-by: BayoNet <da-daos@yandex.ru> * Revert "enbaskakova-DOCSUP-652 (#101)" (#107) This reverts commit 639fee7610f28e421d14e535b7def3f466e7efca. * CLICKHOUSEDOCS-624: Fixed links. Was 60, became 13. * CLICKHOUSEDOCS-624: Finished fix links in Enlish version. * CLICKHOUSEDOCS-624: Fixed RU links Co-authored-by: elenaspb2019 <47083263+elenaspb2019@users.noreply.github.com> Co-authored-by: elenbaskakova <elenbaskakova@yandex-team.ru> Co-authored-by: Sergei Shtykov <bayonet@yandex-team.ru>
2020-05-06 06:13:29 +00:00
に [ファイル](../special/file.md#table_engines-file) と [URL](../special/url.md#table_engines-url) エンジンが、Hadoop固有の機能を提供します。
2020-04-04 09:15:31 +00:00
## 使用法 {#usage}
2020-04-04 09:15:31 +00:00
``` sql
ENGINE = HDFS(URI, format)
```
その `URI` パラメータは、HDFS内のファイルURI全体です。
2020-04-04 09:15:31 +00:00
その `format` パラメータを指定するか、ファイルのファイルフォーマット 実行するには
`SELECT` この形式は、入力と実行のためにサポートされている必要があります
2020-04-04 09:15:31 +00:00
`INSERT` queries for output. The available formats are listed in the
[形式](../../../interfaces/formats.md#formats) セクション
のパス部分 `URI` globsを含むことができます。 この場合、テーブルはreadonlyになります。
2020-04-04 09:15:31 +00:00
**例:**
2020-04-04 09:15:31 +00:00
**1.** セットアップ `hdfs_engine_table` テーブル:
``` sql
CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV')
```
**2.** Fillファイル:
``` sql
INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3)
```
**3.** データの照会:
2020-04-04 09:15:31 +00:00
``` sql
SELECT * FROM hdfs_engine_table LIMIT 2
```
``` text
┌─name─┬─value─┐
│ one │ 1 │
│ two │ 2 │
└──────┴───────┘
```
## 実装の詳細 {#implementation-details}
- 読み書きできる並列
- 対応していません:
- `ALTER``SELECT...SAMPLE` 作戦だ
2020-04-04 09:15:31 +00:00
- インデックス。
- 複製。
2020-04-04 09:15:31 +00:00
**パス内のグロブ**
複数のパスコンポーネ のための処理中のファイルが存在するマッチのパスのパターンです。 ファイルのリストは `SELECT` (ではない `CREATE` 瞬間)。
2020-04-04 09:15:31 +00:00
- `*` — Substitutes any number of any characters except `/` 空の文字列を含む。
- `?` — Substitutes any single character.
- `{some_string,another_string,yet_another_one}` — Substitutes any of strings `'some_string', 'another_string', 'yet_another_one'`.
- `{N..M}` — Substitutes any number in range from N to M including both borders.
構造との `{}` に類似しています [リモート](../../../sql-reference/table-functions/remote.md) テーブル関数。
2020-04-04 09:15:31 +00:00
**例**
2020-04-04 09:15:31 +00:00
1. HDFS上に次のUriを持つTSV形式のファイルがいくつかあるとします:
2020-04-04 09:15:31 +00:00
- hdfs://hdfs1:9000/some\_dir/some\_file\_1
- hdfs://hdfs1:9000/some\_dir/some\_file\_2
- hdfs://hdfs1:9000/some\_dir/some\_file\_3
- hdfs://hdfs1:9000/another\_dir/some\_file\_1
- hdfs://hdfs1:9000/another\_dir/some\_file\_2
- hdfs://hdfs1:9000/another\_dir/some\_file\_3
1. あはいくつかの方法が考えられているテーブルの構成は、すべてのファイル:
<!-- -->
``` sql
CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV')
```
別の方法:
``` sql
CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV')
```
テーブルはすべてのファイルの両方のディレクトリ(すべてのファイルが満たすべき書式は、スキーマに記載のクエリ):
``` sql
CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV')
```
!!! warning "警告"
ファイ `?`.
2020-04-04 09:15:31 +00:00
**例**
2020-04-04 09:15:31 +00:00
このように作成されたテーブルとファイル名 `file000`, `file001`, … , `file999`:
``` sql
CREARE TABLE big_table (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV')
```
## 仮想列 {#virtual-columns}
- `_path` — Path to the file.
- `_file` — Name of the file.
**も参照。**
2020-04-04 09:15:31 +00:00
- [仮想列](../index.md#table_engines-virtual_columns)
[元の記事](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) <!--hide-->