ClickHouse/docs/tr/engines/table-engines/integrations/hdfs.md
Ivan Blinkov d91c97d15d
[docs] replace underscores with hyphens (#10606)
* Replace underscores with hyphens

* remove temporary code

* fix style check

* fix collapse
2020-04-30 21:19:18 +03:00

4.2 KiB
Raw Blame History

machine_translated machine_translated_rev toc_priority toc_title
true e8cd92bba3 36 HDFS

HDFS

Bu motor ile entegrasyon sağlar Apache Hadoop üzerinde veri Yönet allowingilmesine izin vererek ekosist dataem HDFSClickHouse aracılığıyla. Bu motor benzer to the Dosya ve URL motorlar, ancak hadoop özgü özellikleri sağlar.

Kullanma

ENGINE = HDFS(URI, format)

Bu URI parametre, HDFSDEKİ tüm dosya URISIDIR. Bu format parametre kullanılabilir dosya biçimlerinden birini belirtir. Gerçekleştirmek SELECT sorgular, biçim giriş için desteklenmeli ve gerçekleştirmek için INSERT queries for output. The available formats are listed in the Biçimliler bölme. Yol kısmı URI globs içerebilir. Bu durumda tablo salt okunur olurdu.

Örnek:

1. Set up the hdfs_engine_table Tablo:

CREATE TABLE hdfs_engine_table (name String, value UInt32) ENGINE=HDFS('hdfs://hdfs1:9000/other_storage', 'TSV')

2. Fil filel file:

INSERT INTO hdfs_engine_table VALUES ('one', 1), ('two', 2), ('three', 3)

3. Verileri sorgula:

SELECT * FROM hdfs_engine_table LIMIT 2
┌─name─┬─value─┐
│ one  │     1 │
│ two  │     2 │
└──────┴───────┘

Uygulama Detayları

  • Okuma ve yazma paralel olabilir
  • Desteklenmiyor:
    • ALTER ve SELECT...SAMPLE harekat.
    • Dizinler.
    • Çoğalma.

Yolda Globs

Birden çok yol bileşenleri globs olabilir. İşlenmek için dosya var olmalı ve tüm yol deseniyle eşleşmelidir. Sırasında dosyaların listelen ofmesini belirler SELECT (not at CREATE an).

  • * — Substitutes any number of any characters except / boş dize dahil.
  • ? — 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.

İle yapılar {} benzer olan uzak tablo işlevi.

Örnek

  1. HDFSDE aşağıdaki Urılerle TSV formatında birkaç dosyamız olduğunu varsayalım:
  • 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. Altı dosyadan oluşan bir tablo oluşturmanın birkaç yolu vardır:
CREATE TABLE table_with_range (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV')

Başka bir yol:

CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/some_file_?', 'TSV')

Tablo, her iki dizindeki tüm dosyalardan oluşur (tüm dosyalar, sorguda açıklanan biçimi ve şemayı karşılamalıdır):

CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV')

!!! warning "Uyarıcı" Dosyaların listelenmesi, önde gelen sıfırlarla sayı aralıkları içeriyorsa, her basamak için parantez içeren yapıyı ayrı ayrı kullanın veya kullanın ?.

Örnek

Adlı dosyaları içeren tablo oluşturma file000, file001, … , file999:

CREARE TABLE big_table (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV')

Sanal Sütunlar

  • _path — Path to the file.
  • _file — Name of the file.

Ayrıca Bakınız

Orijinal makale