ClickHouse/docs/tr/sql-reference/functions/ym-dict-functions.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

8.1 KiB
Raw Blame History

machine_translated machine_translated_rev toc_priority toc_title
true e8cd92bba3 59 Yandex ile çalışmak.Metrica Sözlükleri

Yandex Ile çalışmak için Fonksiyonlar.Metrica sözlükleri

Aşağıdaki işlevlerin çalışması için, sunucu yapılandırmasının tüm Yandexi almak için yolları ve adresleri belirtmesi gerekir.Metrica sözlükler. Sözlükler, bu işlevlerden herhangi birinin ilk çağrısında yüklenir. Başvuru listeleri yüklenemiyorsa, bir özel durum atılır.

Başvuru listeleri oluşturma hakkında daha fazla bilgi için bölüme bakın “Dictionaries”.

Çoklu Geobazlar

ClickHouse, belirli bölgelerin hangi ülkelere ait olduğu konusunda çeşitli perspektifleri desteklemek için aynı anda birden fazla alternatif jeobaz (bölgesel hiyerarşiler) ile çalışmayı destekler.

Bu clickhouse-server config, dosyayı bölgesel hiyerarşi ile belirtir::<path_to_regions_hierarchy_file>/opt/geo/regions_hierarchy.txt</path_to_regions_hierarchy_file>

Bu dosyanın yanı sıra, yakındaki _ sembolüne ve isme eklenen herhangi bir sonek (dosya uzantısından önce) olan dosyaları da arar. Örneğin, dosyayı da bulacaktır /opt/geo/regions_hierarchy_ua.txt varsa.

ua sözlük anahtarı denir. Soneksiz bir sözlük için anahtar boş bir dizedir.

Tüm sözlükler çalışma zamanında yeniden yüklenir (buıltın_dıctıonarıes_reload_ınterval yapılandırma parametresinde tanımlandığı gibi belirli sayıda saniyede bir kez veya varsayılan olarak saatte bir kez). Ancak, sunucu başladığında kullanılabilir sözlüklerin listesi bir kez tanımlanır.

All functions for working with regions have an optional argument at the end the dictionary key. It is referred to as the geobase. Örnek:

regionToCountry(RegionID)  Uses the default dictionary: /opt/geo/regions_hierarchy.txt
regionToCountry(RegionID, '')  Uses the default dictionary: /opt/geo/regions_hierarchy.txt
regionToCountry(RegionID, 'ua')  Uses the dictionary for the 'ua' key: /opt/geo/regions_hierarchy_ua.txt

regionToCity (id [, geobase])

Accepts a UInt32 number the region ID from the Yandex geobase. If this region is a city or part of a city, it returns the region ID for the appropriate city. Otherwise, returns 0.

regionToArea (id [, geobase])

Bir bölgeyi bir alana dönüştürür (geobase içinde 5 yazın). Diğer her şekilde, bu işlev aynıdır regionToCity.

SELECT DISTINCT regionToName(regionToArea(toUInt32(number), 'ua'))
FROM system.numbers
LIMIT 15
┌─regionToName(regionToArea(toUInt32(number), \'ua\'))─┐
│                                                      │
│ Moscow and Moscow region                             │
│ St. Petersburg and Leningrad region                  │
│ Belgorod region                                      │
│ Ivanovsk region                                      │
│ Kaluga region                                        │
│ Kostroma region                                      │
│ Kursk region                                         │
│ Lipetsk region                                       │
│ Orlov region                                         │
│ Ryazan region                                        │
│ Smolensk region                                      │
│ Tambov region                                        │
│ Tver region                                          │
│ Tula region                                          │
└──────────────────────────────────────────────────────┘

regionToDistrict (id [, geobase])

Bir bölgeyi federal bir bölgeye dönüştürür (geobase içinde tip 4). Diğer her şekilde, bu işlev aynıdır regionToCity.

SELECT DISTINCT regionToName(regionToDistrict(toUInt32(number), 'ua'))
FROM system.numbers
LIMIT 15
┌─regionToName(regionToDistrict(toUInt32(number), \'ua\'))─┐
│                                                          │
│ Central federal district                                 │
│ Northwest federal district                               │
│ South federal district                                   │
│ North Caucases federal district                          │
│ Privolga federal district                                │
│ Ural federal district                                    │
│ Siberian federal district                                │
│ Far East federal district                                │
│ Scotland                                                 │
│ Faroe Islands                                            │
│ Flemish region                                           │
│ Brussels capital region                                  │
│ Wallonia                                                 │
│ Federation of Bosnia and Herzegovina                     │
└──────────────────────────────────────────────────────────┘

regionToCountry (ıd [, geobase])

Bir bölgeyi bir ülkeye dönüştürür. Diğer her şekilde, bu işlev aynıdır regionToCity. Örnek: regionToCountry(toUInt32(213)) = 225 Moskovayı (213) Rusyaya (225) dönüştürür.

regionToContinent (id [, geobase])

Bir bölgeyi bir kıtaya dönüştürür. Diğer her şekilde, bu işlev aynıdır regionToCity. Örnek: regionToContinent(toUInt32(213)) = 10001 Moskovayı (213) Avrasyaya (10001) dönüştürür.

regionToTopContinent (#regiontotopcontinent)

Bölgenin hiyerarşisinde en yüksek kıtayı bulur.

Sözdizimi

regionToTopContinent(id[, geobase]);

Parametre

Döndürülen değer

  • Üst düzey kıtanın tanımlayıcısı (bölgeler hiyerarşisine tırmandığınızda ikincisi).
  • 0, yoksa.

Tür: UInt32.

regionToPopulation (id [, geobase])

Bir bölge için nüfusu alır. Nüfus geobase ile dosyalarda kaydedilebilir. Bölümüne bakınız “External dictionaries”. Bölge için nüfus kaydedilmezse, 0 döndürür. Yandex geobasede, nüfus alt bölgeler için kaydedilebilir, ancak üst bölgeler için kaydedilemez.

regionİn (lhs, rhs [, geobase])

Olup olmadığını denetler bir lhs bölge bir rhs bölge. Aitse 1e eşit bir Uİnt8 numarası veya ait değilse 0 döndürür. The relationship is reflexive any region also belongs to itself.

regionHierarchy (id [, geobase])

Accepts a UInt32 number the region ID from the Yandex geobase. Returns an array of region IDs consisting of the passed region and all parents along the chain. Örnek: regionHierarchy(toUInt32(213)) = [213,1,3,225,10001,10000].

regionToName (id [, lang])

Accepts a UInt32 number the region ID from the Yandex geobase. A string with the name of the language can be passed as a second argument. Supported languages are: ru, en, ua, uk, by, kz, tr. If the second argument is omitted, the language ru is used. If the language is not supported, an exception is thrown. Returns a string the name of the region in the corresponding language. If the region with the specified ID doesnt exist, an empty string is returned.

ua ve uk hem Ukrayna demek.

Orijinal makale