未验证 提交 174b687a 编写于 作者: Z zzsmdfj 提交者: GitHub

update zh-docs-functions (#11464)

上级 a9c783d0
......@@ -22,7 +22,7 @@ Strings are compared by bytes. A shorter string is smaller than all strings that
## equals, a = b and a == b operator {#function-equals}
## notEquals, a ! operator= b and a \<\> b {#function-notequals}
## notEquals, a != b and a \<\> b operator {#function-notequals}
## less, \< operator {#function-less}
......
---
toc_priority: 51
toc_title: 低基数类型
---
# 低基数类型 {#lowcardinality-data-type}
把其它数据类型转变为字典编码类型。
## 语法 {#lowcardinality-syntax}
```sql
LowCardinality(data_type)
```
**参数**
- `data_type`[String](string.md), [FixedString](fixedstring.md), [Date](date.md), [DateTime](datetime.md),包括数字类型,但是[Decimal](decimal.md)除外。对一些数据类型来说,`LowCardinality` 并不高效,详查[allow_suspicious_low_cardinality_types](../../operations/settings/settings.md#allow_suspicious_low_cardinality_types)设置描述。
## 描述 {#lowcardinality-dscr}
`LowCardinality` 是一种改变数据存储和数据处理方法的概念。 ClickHouse会把 `LowCardinality` 所在的列进行[dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder)。对很多应用来说,处理字典编码的数据可以显著的增加[SELECT](../statements/select/index.md)查询速度。
使用 `LowCarditality` 数据类型的效率依赖于数据的多样性。如果一个字典包含少于10000个不同的值,那么ClickHouse可以进行更高效的数据存储和处理。反之如果字典多于10000,效率会表现的更差。
当使用字符类型的时候,可以考虑使用 `LowCardinality` 代替[Enum](enum.md)`LowCardinality` 通常更加灵活和高效。
## 例子
创建一个 `LowCardinality` 类型的列:
```sql
CREATE TABLE lc_t
(
`id` UInt16,
`strings` LowCardinality(String)
)
ENGINE = MergeTree()
ORDER BY id
```
## 相关的设置和函数
设置:
- [low_cardinality_max_dictionary_size](../../operations/settings/settings.md#low_cardinality_max_dictionary_size)
- [low_cardinality_use_single_dictionary_for_part](../../operations/settings/settings.md#low_cardinality_use_single_dictionary_for_part)
- [low_cardinality_allow_in_native_format](../../operations/settings/settings.md#low_cardinality_allow_in_native_format)
- [allow_suspicious_low_cardinality_types](../../operations/settings/settings.md#allow_suspicious_low_cardinality_types)
函数:
- [toLowCardinality](../functions/type-conversion-functions.md#tolowcardinality)
## 参考
- [高效低基数类型](https://www.altinity.com/blog/2019/3/27/low-cardinality).
- [使用低基数类型减少ClickHouse的存储成本 – 来自Instana工程师的分享](https://www.instana.com/blog/reducing-clickhouse-storage-cost-with-the-low-cardinality-type-lessons-from-an-instana-engineer/).
- [字符优化 (俄语视频分享)](https://youtu.be/rqf-ILRgBdY?list=PL0Z2YDlm0b3iwXCpEFiOOYmwXzVmjJfEt). [英语分享](https://github.com/yandex/clickhouse-presentations/raw/master/meetup19/string_optimization.pdf).
\ No newline at end of file
---
toc_priority: 35
toc_title: 算术函数
---
# 算术函数 {#suan-zhu-han-shu}
对于所有算术函数,结果类型为结果适合的最小数字类型(如果存在这样的类型)。最小数字类型是根据数字的位数,是否有符号以及是否是浮点类型而同时进行的。如果没有足够的位,则采用最高位类型。
......
---
toc_priority: 36
toc_title: 比较函数
---
# 比较函数 {#bi-jiao-han-shu}
比较函数始终返回0或1(UInt8)。
......@@ -15,18 +20,16 @@
字符串按字节进行比较。较短的字符串小于以其开头并且至少包含一个字符的所有字符串。
注意。直到1.1.54134版本,有符号和无符号数字的比较方式与C++相同。换句话说,在SELECT 9223372036854775807 &gt; -1 等情况下,您可能会得到错误的结果。 此行为在版本1.1.54134中已更改,现在在数学上是正确的。
## 等于,a=b和a==b运算符 {#equals-a-b-and-a-b-operator}
## 等于,a=b和a==b 运算符 {#equals-a-b-and-a-b-operator}
## notEquals,a! 运算符=b和a `<>` b {#notequals-a-operator-b-and-a-b}
## 不等于,a!=b和a<>b 运算符 {#notequals-a-operator-b-and-a-b}
## 少, `< operator` {#less-operator}
## 少, < 运算符 {#less-operator}
## 更大, `> operator` {#greater-operator}
## 大于, > 运算符 {#greater-operator}
## 出租等级, `<= operator` {#lessorequals-operator}
## 小于等于, <= 运算符 {#lessorequals-operator}
## 伟大的等级, `>= operator` {#greaterorequals-operator}
## 大于等于, >= 运算符 {#greaterorequals-operator}
[来源文章](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) <!--hide-->
---
toc_folder_title: 函数
toc_priority: 32
toc_title: 简介
---
# 函数 {#han-shu}
ClickHouse中至少存在两种类型的函数 - 常规函数(它们称之为«函数»)和聚合函数。 常规函数的工作就像分别为每一行执行一次函数计算一样(对于每一行,函数的结果不依赖于其他行)。 聚合函数则从各行累积一组值(即函数的结果以来整个结果集)。
......
---
toc_priority: 37
toc_title: 逻辑函数
---
# 逻辑函数 {#luo-ji-han-shu}
逻辑函数可以接受任何数字类型的参数,并返回UInt8类型的0或1。
当向函数传递零时,函数将判定为«false»,否则,任何其他非零的值都将被判定为«true»。
## 和,和运营商 {#and-and-operator}
## 和,`AND` 运算符 {#and-and-operator}
## 或,或运营商 {#or-or-operator}
## 或,`OR` 运算符 {#or-or-operator}
## 不是,不是运营商 {#not-not-operator}
## 非,`NOT` 运算符 {#not-not-operator}
## 异或 {#xor}
## 异或,`XOR` 运算符 {#xor}
[来源文章](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) <!--hide-->
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册