mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
4ec7821fec
* 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 639fee7610
.
* CLICKHOUSEDOCS-624: Fixed en
* CLICKHOUSEDOCS-624: Fixed RU.
* CLICKHOUSEDOCS-624: Fixed ES and FR.
* CLICKHOUSEDOCS-624: Fixed JA and TR
* CLICKHOUSEDOCS-624: Fixed FA.
* CLICKHOUSEDOCS-624: Fixed ZH.
* Update docs/tools/test.py
Co-authored-by: Ivan Blinkov <github@blinkov.ru>
* Update docs/tools/test.py
Co-authored-by: Ivan Blinkov <github@blinkov.ru>
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>
Co-authored-by: Ivan Blinkov <github@blinkov.ru>
3.1 KiB
3.1 KiB
toc_priority | toc_title |
---|---|
60 | clickhouse-local |
ツ环板-ョツ嘉ッツ偲
该 clickhouse-local
程序使您能够对本地文件执行快速处理,而无需部署和配置ClickHouse服务器。
接受表示表的数据并使用以下方式查询它们 ツ环板ECTョツ嘉ッツ偲.
clickhouse-local
使用与ClickHouse server相同的核心,因此它支持大多数功能以及相同的格式和表引擎。
默认情况下 clickhouse-local
不能访问同一主机上的数据,但它支持使用以下方式加载服务器配置 --config-file
争论。
!!! warning "警告"
不建议将生产服务器配置加载到 clickhouse-local
因为数据可以在人为错误的情况下被损坏。
用途
基本用法:
clickhouse-local --structure "table_structure" --input-format "format_of_incoming_data" -q "query"
参数:
-S
,--structure
— table structure for input data.-if
,--input-format
— input format,TSV
默认情况下。-f
,--file
— path to data,stdin
默认情况下。-q
--query
— queries to execute with;
如delimeter。-N
,--table
— table name where to put output data,table
默认情况下。-of
,--format
,--output-format
— output format,TSV
默认情况下。--stacktrace
— whether to dump debug output in case of exception.--verbose
— more details on query execution.-s
— disablesstderr
记录。--config-file
— path to configuration file in same format as for ClickHouse server, by default the configuration empty.--help
— arguments references forclickhouse-local
.
还有每个ClickHouse配置变量的参数,这些变量更常用,而不是 --config-file
.
例
echo -e "1,2\n3,4" | clickhouse-local -S "a Int64, b Int64" -if "CSV" -q "SELECT * FROM table"
Read 2 rows, 32.00 B in 0.000 sec., 5182 rows/sec., 80.97 KiB/sec.
1 2
3 4
前面的例子是一样的:
$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table"
Read 2 rows, 32.00 B in 0.000 sec., 4987 rows/sec., 77.93 KiB/sec.
1 2
3 4
现在让我们为每个Unix用户输出内存用户:
$ ps aux | tail -n +2 | awk '{ printf("%s\t%s\n", $1, $4) }' | clickhouse-local -S "user String, mem Float64" -q "SELECT user, round(sum(mem), 2) as memTotal FROM table GROUP BY user ORDER BY memTotal DESC FORMAT Pretty"
Read 186 rows, 4.15 KiB in 0.035 sec., 5302 rows/sec., 118.34 KiB/sec.
┏━━━━━━━━━━┳━━━━━━━━━━┓
┃ user ┃ memTotal ┃
┡━━━━━━━━━━╇━━━━━━━━━━┩
│ bayonet │ 113.5 │
├──────────┼──────────┤
│ root │ 8.8 │
├──────────┼──────────┤
...