Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
174b687a
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
174b687a
编写于
6月 08, 2020
作者:
Z
zzsmdfj
提交者:
GitHub
6月 08, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-docs-functions (#11464)
上级
a9c783d0
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
590 addition
and
43 deletion
+590
-43
docs/en/sql-reference/functions/comparison-functions.md
docs/en/sql-reference/functions/comparison-functions.md
+1
-1
docs/zh/sql-reference/data-types/lowcardinality.md
docs/zh/sql-reference/data-types/lowcardinality.md
+59
-0
docs/zh/sql-reference/functions/arithmetic-functions.md
docs/zh/sql-reference/functions/arithmetic-functions.md
+5
-0
docs/zh/sql-reference/functions/comparison-functions.md
docs/zh/sql-reference/functions/comparison-functions.md
+11
-8
docs/zh/sql-reference/functions/index.md
docs/zh/sql-reference/functions/index.md
+6
-0
docs/zh/sql-reference/functions/logical-functions.md
docs/zh/sql-reference/functions/logical-functions.md
+9
-4
docs/zh/sql-reference/functions/type-conversion-functions.md
docs/zh/sql-reference/functions/type-conversion-functions.md
+499
-30
未找到文件。
docs/en/sql-reference/functions/comparison-functions.md
浏览文件 @
174b687a
...
@@ -22,7 +22,7 @@ Strings are compared by bytes. A shorter string is smaller than all strings that
...
@@ -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}
## 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}
## less, \< operator {#function-less}
...
...
docs/zh/sql-reference/data-types/lowcardinality.md
0 → 100644
浏览文件 @
174b687a
---
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
docs/zh/sql-reference/functions/arithmetic-functions.md
浏览文件 @
174b687a
---
toc_priority
:
35
toc_title
:
算术函数
---
# 算术函数 {#suan-zhu-han-shu}
# 算术函数 {#suan-zhu-han-shu}
对于所有算术函数,结果类型为结果适合的最小数字类型(如果存在这样的类型)。最小数字类型是根据数字的位数,是否有符号以及是否是浮点类型而同时进行的。如果没有足够的位,则采用最高位类型。
对于所有算术函数,结果类型为结果适合的最小数字类型(如果存在这样的类型)。最小数字类型是根据数字的位数,是否有符号以及是否是浮点类型而同时进行的。如果没有足够的位,则采用最高位类型。
...
...
docs/zh/sql-reference/functions/comparison-functions.md
浏览文件 @
174b687a
---
toc_priority
:
36
toc_title
:
比较函数
---
# 比较函数 {#bi-jiao-han-shu}
# 比较函数 {#bi-jiao-han-shu}
比较函数始终返回0或1(UInt8)。
比较函数始终返回0或1(UInt8)。
...
@@ -15,18 +20,16 @@
...
@@ -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-->
[
来源文章
](
https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/
)
<!--hide-->
docs/zh/sql-reference/functions/index.md
浏览文件 @
174b687a
---
toc_folder_title
:
函数
toc_priority
:
32
toc_title
:
简介
---
# 函数 {#han-shu}
# 函数 {#han-shu}
ClickHouse中至少存在两种类型的函数 - 常规函数(它们称之为«函数»)和聚合函数。 常规函数的工作就像分别为每一行执行一次函数计算一样(对于每一行,函数的结果不依赖于其他行)。 聚合函数则从各行累积一组值(即函数的结果以来整个结果集)。
ClickHouse中至少存在两种类型的函数 - 常规函数(它们称之为«函数»)和聚合函数。 常规函数的工作就像分别为每一行执行一次函数计算一样(对于每一行,函数的结果不依赖于其他行)。 聚合函数则从各行累积一组值(即函数的结果以来整个结果集)。
...
...
docs/zh/sql-reference/functions/logical-functions.md
浏览文件 @
174b687a
---
toc_priority
:
37
toc_title
:
逻辑函数
---
# 逻辑函数 {#luo-ji-han-shu}
# 逻辑函数 {#luo-ji-han-shu}
逻辑函数可以接受任何数字类型的参数,并返回UInt8类型的0或1。
逻辑函数可以接受任何数字类型的参数,并返回UInt8类型的0或1。
当向函数传递零时,函数将判定为«false»,否则,任何其他非零的值都将被判定为«true»。
当向函数传递零时,函数将判定为«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-->
[
来源文章
](
https://clickhouse.tech/docs/en/query_language/functions/logical_functions/
)
<!--hide-->
docs/zh/sql-reference/functions/type-conversion-functions.md
浏览文件 @
174b687a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录