Merge branch 'master' into test_multiple_nodes

This commit is contained in:
Alexander Tokmakov 2021-03-16 21:29:26 +03:00
commit 2d34bbb4b2
629 changed files with 12996 additions and 3973 deletions

View File

@ -178,7 +178,7 @@ tail:
size -= padding;
}
/// Aligned unrolled copy. We will use all available SSE registers.
/// Aligned unrolled copy. We will use half of available SSE registers.
/// It's not possible to have both src and dst aligned.
/// So, we will use aligned stores and unaligned loads.
__m128i c0, c1, c2, c3, c4, c5, c6, c7;

2
contrib/poco vendored

@ -1 +1 @@
Subproject commit c55b91f394efa9c238c33957682501681ef9b716
Subproject commit 83beecccb09eec0c9fd2669cacea03ede1d9f138

View File

@ -130,6 +130,7 @@ zgrep -Fa "########################################" /test_output/* > /dev/null
pigz < /var/log/clickhouse-server/clickhouse-server.log > /test_output/clickhouse-server.log.gz
tar -chf /test_output/coordination.tar /var/lib/clickhouse/coordination ||:
mv /var/log/clickhouse-server/stderr.log /test_output/
tar -chf /test_output/query_log_dump.tar /var/lib/clickhouse/data/system/query_log ||:
# Write check result into check_status.tsv
clickhouse-local --structure "test String, res String" -q "SELECT 'failure', test FROM table WHERE res != 'OK' order by (lower(test) like '%hung%') LIMIT 1" < /test_output/test_results.tsv > /test_output/check_status.tsv

View File

@ -67,6 +67,10 @@ def prepare_for_hung_check():
logging.info("Will terminate gdb (if any)")
call("kill -TERM $(pidof gdb)", shell=True, stderr=STDOUT)
# Some tests set too low memory limit for default user and forget to reset in back.
# It may cause SYSTEM queries to fail, let's disable memory limit.
call("clickhouse client --max_memory_usage_for_user=0 -q 'SELECT 1 FORMAT Null'", shell=True, stderr=STDOUT)
# Some tests execute SYSTEM STOP MERGES or similar queries.
# It may cause some ALTERs to hang.
# Possibly we should fix tests and forbid to use such queries without specifying table.
@ -78,7 +82,13 @@ def prepare_for_hung_check():
call("clickhouse client -q 'SYSTEM START REPLICATED SENDS'", shell=True, stderr=STDOUT)
call("clickhouse client -q 'SYSTEM START REPLICATION QUEUES'", shell=True, stderr=STDOUT)
time.sleep(30)
# Issue #21004, live views are experimental, so let's just suppress it
call("""clickhouse client -q "KILL QUERY WHERE upper(query) LIKE 'WATCH %'" """, shell=True, stderr=STDOUT)
# Wait for last queries to finish if any, not longer than 120 seconds
call("""clickhouse client -q "select sleepEachRow((
select maxOrDefault(120 - elapsed) + 1 from system.processes where query not like '%from system.processes%' and elapsed < 120
) / 120) from numbers(120) format Null" """, shell=True, stderr=STDOUT)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')

View File

@ -35,7 +35,7 @@ RUN apt-get update \
ENV TZ=Europe/Moscow
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN pip3 install urllib3 testflows==1.6.72 docker-compose docker dicttoxml kazoo tzlocal
RUN pip3 install urllib3 testflows==1.6.74 docker-compose docker dicttoxml kazoo tzlocal
ENV DOCKER_CHANNEL stable
ENV DOCKER_VERSION 17.09.1-ce

1
docs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

View File

@ -39,4 +39,4 @@ ENGINE = EmbeddedRocksDB
PRIMARY KEY key
```
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/embedded-rocksdb/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/embedded-rocksdb/) <!--hide-->

View File

@ -5,7 +5,7 @@ toc_title: HDFS
# HDFS {#table_engines-hdfs}
This engine provides integration with [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) ecosystem by allowing to manage data on [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html)via ClickHouse. This engine is similar
This engine provides integration with [Apache Hadoop](https://en.wikipedia.org/wiki/Apache_Hadoop) ecosystem by allowing to manage data on [HDFS](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html) via ClickHouse. This engine is similar
to the [File](../../../engines/table-engines/special/file.md#table_engines-file) and [URL](../../../engines/table-engines/special/url.md#table_engines-url) engines, but provides Hadoop-specific features.
## Usage {#usage}
@ -174,7 +174,7 @@ Similar to GraphiteMergeTree, the HDFS engine supports extended configuration us
| dfs\_domain\_socket\_path | "" |
[HDFS Configuration Reference ](https://hawq.apache.org/docs/userguide/2.3.0.0-incubating/reference/HDFSConfigurationParameterReference.html) might explain some parameters.
[HDFS Configuration Reference](https://hawq.apache.org/docs/userguide/2.3.0.0-incubating/reference/HDFSConfigurationParameterReference.html) might explain some parameters.
#### ClickHouse extras {#clickhouse-extras}
@ -185,7 +185,6 @@ Similar to GraphiteMergeTree, the HDFS engine supports extended configuration us
|hadoop\_kerberos\_kinit\_command | kinit |
#### Limitations {#limitations}
* hadoop\_security\_kerberos\_ticket\_cache\_path can be global only, not user specific
## Kerberos support {#kerberos-support}
@ -207,4 +206,4 @@ If hadoop\_kerberos\_keytab, hadoop\_kerberos\_principal or hadoop\_kerberos\_ki
- [Virtual columns](../../../engines/table-engines/index.md#table_engines-virtual_columns)
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/hdfs/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/hdfs/) <!--hide-->

View File

@ -18,3 +18,6 @@ List of supported integrations:
- [Kafka](../../../engines/table-engines/integrations/kafka.md)
- [EmbeddedRocksDB](../../../engines/table-engines/integrations/embedded-rocksdb.md)
- [RabbitMQ](../../../engines/table-engines/integrations/rabbitmq.md)
- [PostgreSQL](../../../engines/table-engines/integrations/postgresql.md)
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/) <!--hide-->

View File

@ -85,4 +85,4 @@ FROM jdbc_table
- [JDBC table function](../../../sql-reference/table-functions/jdbc.md).
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/jdbc/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/jdbc/) <!--hide-->

View File

@ -194,4 +194,4 @@ Example:
- [Virtual columns](../../../engines/table-engines/index.md#table_engines-virtual_columns)
- [background_schedule_pool_size](../../../operations/settings/settings.md#background_schedule_pool_size)
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/kafka/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/kafka/) <!--hide-->

View File

@ -54,4 +54,4 @@ SELECT COUNT() FROM mongo_table;
└─────────┘
```
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/integrations/mongodb/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/mongodb/) <!--hide-->

View File

@ -24,6 +24,7 @@ The table structure can differ from the original MySQL table structure:
- Column names should be the same as in the original MySQL table, but you can use just some of these columns and in any order.
- Column types may differ from those in the original MySQL table. ClickHouse tries to [cast](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) values to the ClickHouse data types.
- Setting `external_table_functions_use_nulls` defines how to handle Nullable columns. Default is true, if false - table function will not make nullable columns and will insert default values instead of nulls. This is also applicable for null values inside array data types.
**Engine Parameters**
@ -100,4 +101,4 @@ SELECT * FROM mysql_table
- [The mysql table function](../../../sql-reference/table-functions/mysql.md)
- [Using MySQL as a source of external dictionary](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-mysql)
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/mysql/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/mysql/) <!--hide-->

View File

@ -29,6 +29,7 @@ The table structure can differ from the source table structure:
- Column names should be the same as in the source table, but you can use just some of these columns and in any order.
- Column types may differ from those in the source table. ClickHouse tries to [cast](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) values to the ClickHouse data types.
- Setting `external_table_functions_use_nulls` defines how to handle Nullable columns. Default is true, if false - table function will not make nullable columns and will insert default values instead of nulls. This is also applicable for null values inside array data types.
**Engine Parameters**
@ -127,4 +128,4 @@ SELECT * FROM odbc_t
- [ODBC external dictionaries](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-odbc)
- [ODBC table function](../../../sql-reference/table-functions/odbc.md)
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/odbc/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/odbc/) <!--hide-->

View File

@ -0,0 +1,106 @@
---
toc_priority: 8
toc_title: PostgreSQL
---
# PosgtreSQL {#postgresql}
The PostgreSQL engine allows you to perform `SELECT` queries on data that is stored on a remote PostgreSQL server.
## Creating a Table {#creating-a-table}
``` sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
(
name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1],
name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2],
...
) ENGINE = PostgreSQL('host:port', 'database', 'table', 'user', 'password');
```
See a detailed description of the [CREATE TABLE](../../../sql-reference/statements/create/table.md#create-table-query) query.
The table structure can differ from the original PostgreSQL table structure:
- Column names should be the same as in the original PostgreSQL table, but you can use just some of these columns and in any order.
- Column types may differ from those in the original PostgreSQL table. ClickHouse tries to [cast](../../../sql-reference/functions/type-conversion-functions.md#type_conversion_function-cast) values to the ClickHouse data types.
- Setting `external_table_functions_use_nulls` defines how to handle Nullable columns. Default is 1, if 0 - table function will not make nullable columns and will insert default values instead of nulls. This is also applicable for null values inside array data types.
**Engine Parameters**
- `host:port` — PostgreSQL server address.
- `database` — Remote database name.
- `table` — Remote table name.
- `user` — PostgreSQL user.
- `password` — User password.
SELECT Queries on PostgreSQL side run as `COPY (SELECT ...) TO STDOUT` inside read-only PostgreSQL transaction with commit after each `SELECT` query.
Simple `WHERE` clauses such as `=, !=, >, >=, <, <=, IN` are executed on the PostgreSQL server.
All joins, aggregations, sorting, `IN [ array ]` conditions and the `LIMIT` sampling constraint are executed in ClickHouse only after the query to PostgreSQL finishes.
INSERT Queries on PostgreSQL side run as `COPY "table_name" (field1, field2, ... fieldN) FROM STDIN` inside PostgreSQL transaction with auto-commit after each `INSERT` statement.
PostgreSQL Array types converts into ClickHouse arrays.
Be careful in PostgreSQL an array data created like a type_name[] may contain multi-dimensional arrays of different dimensions in different table rows in same column, but in ClickHouse it is only allowed to have multidimensional arrays of the same count of dimensions in all table rows in same column.
## Usage Example {#usage-example}
Table in PostgreSQL:
``` text
postgres=# CREATE TABLE "public"."test" (
"int_id" SERIAL,
"int_nullable" INT NULL DEFAULT NULL,
"float" FLOAT NOT NULL,
"str" VARCHAR(100) NOT NULL DEFAULT '',
"float_nullable" FLOAT NULL DEFAULT NULL,
PRIMARY KEY (int_id));
CREATE TABLE
postgres=# insert into test (int_id, str, "float") VALUES (1,'test',2);
INSERT 0 1
postgresql> select * from test;
int_id | int_nullable | float | str | float_nullable
--------+--------------+-------+------+----------------
1 | | 2 | test |
(1 row)
```
Table in ClickHouse, retrieving data from the PostgreSQL table created above:
``` sql
CREATE TABLE default.postgresql_table
(
`float_nullable` Nullable(Float32),
`str` String,
`int_id` Int32
)
ENGINE = PostgreSQL('localhost:5432', 'public', 'test', 'postges_user', 'postgres_password');
```
``` sql
SELECT * FROM postgresql_table WHERE str IN ('test')
```
``` text
┌─float_nullable─┬─str──┬─int_id─┐
│ ᴺᵁᴸᴸ │ test │ 1 │
└────────────────┴──────┴────────┘
1 rows in set. Elapsed: 0.019 sec.
```
## See Also {#see-also}
- [The postgresql table function](../../../sql-reference/table-functions/postgresql.md)
- [Using PostgreSQL as a source of external dictionary](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md#dicts-external_dicts_dict_sources-postgresql)
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/postgresql/) <!--hide-->

View File

@ -163,3 +163,5 @@ Example:
- `_redelivered` - `redelivered` flag of the message.
- `_message_id` - messageID of the received message; non-empty if was set, when message was published.
- `_timestamp` - timestamp of the received message; non-empty if was set, when message was published.
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/rabbitmq/) <!--hide-->

View File

@ -6,11 +6,11 @@ toc_title: S3
# S3 {#table_engines-s3}
This engine provides integration with [Amazon S3](https://aws.amazon.com/s3/) ecosystem. This engine is similar
to the [HDFS](../../../engines/table-engines/special/file.md#table_engines-hdfs) engine, but provides S3-specific features.
to the [HDFS](../../../engines/table-engines/integrations/hdfs.md#table_engines-hdfs) engine, but provides S3-specific features.
## Usage {#usage}
``` sql
```sql
ENGINE = S3(path, [aws_access_key_id, aws_secret_access_key,] format, structure, [compression])
```
@ -25,23 +25,23 @@ ENGINE = S3(path, [aws_access_key_id, aws_secret_access_key,] format, structure,
**1.** Set up the `s3_engine_table` table:
``` sql
```sql
CREATE TABLE s3_engine_table (name String, value UInt32) ENGINE=S3('https://storage.yandexcloud.net/my-test-bucket-768/test-data.csv.gz', 'CSV', 'name String, value UInt32', 'gzip')
```
**2.** Fill file:
``` sql
```sql
INSERT INTO s3_engine_table VALUES ('one', 1), ('two', 2), ('three', 3)
```
**3.** Query the data:
``` sql
```sql
SELECT * FROM s3_engine_table LIMIT 2
```
``` text
```text
┌─name─┬─value─┐
│ one │ 1 │
│ two │ 2 │
@ -69,7 +69,7 @@ Constructions with `{}` are similar to the [remote](../../../sql-reference/table
**Example**
1. Suppose we have several files in TSV format with the following URIs on HDFS:
1. Suppose we have several files in CSV format with the following URIs on S3:
- https://storage.yandexcloud.net/my-test-bucket-768/some_prefix/some_file_1.csv
- https://storage.yandexcloud.net/my-test-bucket-768/some_prefix/some_file_2.csv
@ -82,19 +82,19 @@ Constructions with `{}` are similar to the [remote](../../../sql-reference/table
<!-- -->
``` sql
```sql
CREATE TABLE table_with_range (name String, value UInt32) ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_prefix/some_file_{1..3}', 'CSV')
```
3. Another way:
``` sql
```sql
CREATE TABLE table_with_question_mark (name String, value UInt32) ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_prefix/some_file_?', 'CSV')
```
4. Table consists of all the files in both directories (all files should satisfy format and schema described in query):
``` sql
```sql
CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_prefix/*', 'CSV')
```
@ -105,7 +105,7 @@ CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = S3('https:
Create table with files named `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
``` sql
```sql
CREATE TABLE big_table (name String, value UInt32) ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/big_prefix/file-{000..999}.csv', 'CSV')
```
@ -124,7 +124,7 @@ The following settings can be set before query execution or placed into configur
- `s3_max_single_part_upload_size` — Default value is `64Mb`. The maximum size of object to upload using singlepart upload to S3.
- `s3_min_upload_part_size` — Default value is `512Mb`. The minimum size of part to upload during multipart upload to [S3 Multipart upload](https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html).
- `s3_max_redirects` — Default value is `10`. Max number of S3 redirects hops allowed.
- `s3_max_redirects` — Default value is `10`. Max number of HTTP redirects S3 hops allowed.
Security consideration: if malicious user can specify arbitrary S3 URLs, `s3_max_redirects` must be set to zero to avoid [SSRF](https://en.wikipedia.org/wiki/Server-side_request_forgery) attacks; or alternatively, `remote_host_filter` must be specified in server configuration.
@ -153,4 +153,4 @@ Example:
</s3>
```
[Original article](https://clickhouse.tech/docs/en/operations/table_engines/s3/) <!--hide-->
[Original article](https://clickhouse.tech/docs/en/engines/table-engines/integrations/s3/) <!--hide-->

View File

@ -353,7 +353,7 @@ The `set` index can be used with all functions. Function subsets for other index
| Function (operator) / Index | primary key | minmax | ngrambf_v1 | tokenbf_v1 | bloom_filter |
|------------------------------------------------------------------------------------------------------------|-------------|--------|-------------|-------------|---------------|
| [equals (=, ==)](../../../sql-reference/functions/comparison-functions.md#function-equals) | ✔ | ✔ | ✔ | ✔ | ✔ |
| [notEquals(!=, \<\>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ |
| [notEquals(!=, <>)](../../../sql-reference/functions/comparison-functions.md#function-notequals) | ✔ | ✔ | ✔ | ✔ | ✔ |
| [like](../../../sql-reference/functions/string-search-functions.md#function-like) | ✔ | ✔ | ✔ | ✔ | ✗ |
| [notLike](../../../sql-reference/functions/string-search-functions.md#function-notlike) | ✔ | ✔ | ✔ | ✔ | ✗ |
| [startsWith](../../../sql-reference/functions/string-functions.md#startswith) | ✔ | ✔ | ✔ | ✔ | ✗ |
@ -361,10 +361,10 @@ The `set` index can be used with all functions. Function subsets for other index
| [multiSearchAny](../../../sql-reference/functions/string-search-functions.md#function-multisearchany) | ✗ | ✗ | ✔ | ✗ | ✗ |
| [in](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ |
| [notIn](../../../sql-reference/functions/in-functions.md#in-functions) | ✔ | ✔ | ✔ | ✔ | ✔ |
| [less (\<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [greater (\>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [lessOrEquals (\<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [greaterOrEquals (\>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [less (<)](../../../sql-reference/functions/comparison-functions.md#function-less) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [greater (>)](../../../sql-reference/functions/comparison-functions.md#function-greater) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [lessOrEquals (<=)](../../../sql-reference/functions/comparison-functions.md#function-lessorequals) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [greaterOrEquals (>=)](../../../sql-reference/functions/comparison-functions.md#function-greaterorequals) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [empty](../../../sql-reference/functions/array-functions.md#function-empty) | ✔ | ✔ | ✗ | ✗ | ✗ |
| [notEmpty](../../../sql-reference/functions/array-functions.md#function-notempty) | ✔ | ✔ | ✗ | ✗ | ✗ |
| hasToken | ✗ | ✗ | ✗ | ✔ | ✗ |
@ -529,7 +529,7 @@ CREATE TABLE table_for_aggregation
y Int
)
ENGINE = MergeTree
ORDER BY k1, k2
ORDER BY (k1, k2)
TTL d + INTERVAL 1 MONTH GROUP BY k1, k2 SET x = max(x), y = min(y);
```
@ -748,7 +748,6 @@ Configuration markup:
</proxy>
<connect_timeout_ms>10000</connect_timeout_ms>
<request_timeout_ms>5000</request_timeout_ms>
<max_connections>100</max_connections>
<retry_attempts>10</retry_attempts>
<min_bytes_for_seek>1000</min_bytes_for_seek>
<metadata_path>/var/lib/clickhouse/disks/s3/</metadata_path>
@ -771,7 +770,6 @@ Optional parameters:
- `proxy` — Proxy configuration for S3 endpoint. Each `uri` element inside `proxy` block should contain a proxy URL.
- `connect_timeout_ms` — Socket connect timeout in milliseconds. Default value is `10 seconds`.
- `request_timeout_ms` — Request timeout in milliseconds. Default value is `5 seconds`.
- `max_connections` — S3 connections pool size. Default value is `100`.
- `retry_attempts` — Number of retry attempts in case of failed request. Default value is `10`.
- `min_bytes_for_seek` — Minimal number of bytes to use seek operation instead of sequential read. Default value is `1 Mb`.
- `metadata_path` — Path on local FS to store metadata files for S3. Default value is `/var/lib/clickhouse/disks/<disk_name>/`.

View File

@ -38,10 +38,10 @@ The queries are executed as a read-only user. It implies some limitations:
The following settings are also enforced:
- [max_result_bytes=10485760](../operations/settings/query_complexity/#max-result-bytes)
- [max_result_rows=2000](../operations/settings/query_complexity/#setting-max_result_rows)
- [result_overflow_mode=break](../operations/settings/query_complexity/#result-overflow-mode)
- [max_execution_time=60000](../operations/settings/query_complexity/#max-execution-time)
- [max_result_bytes=10485760](../operations/settings/query-complexity/#max-result-bytes)
- [max_result_rows=2000](../operations/settings/query-complexity/#setting-max_result_rows)
- [result_overflow_mode=break](../operations/settings/query-complexity/#result-overflow-mode)
- [max_execution_time=60000](../operations/settings/query-complexity/#max-execution-time)
## Examples {#examples}

View File

@ -1254,7 +1254,7 @@ ClickHouse supports configurable precision of `Decimal` type. The `INSERT` query
Unsupported Parquet data types: `DATE32`, `TIME32`, `FIXED_SIZE_BINARY`, `JSON`, `UUID`, `ENUM`.
Data types of ClickHouse table columns can differ from the corresponding fields of the Parquet data inserted. When inserting data, ClickHouse interprets data types according to the table above and then [cast](../query_language/functions/type_conversion_functions/#type_conversion_function-cast) the data to that data type which is set for the ClickHouse table column.
Data types of ClickHouse table columns can differ from the corresponding fields of the Parquet data inserted. When inserting data, ClickHouse interprets data types according to the table above and then [cast](../sql-reference/functions/type-conversion-functions/#type_conversion_function-cast) the data to that data type which is set for the ClickHouse table column.
### Inserting and Selecting Data {#inserting-and-selecting-data}

View File

@ -167,4 +167,21 @@ Features:
[How to configure ClickHouse in Looker.](https://docs.looker.com/setup-and-management/database-config/clickhouse)
### SeekTable {#seektable}
[SeekTable](https://www.seektable.com) is a self-service BI tool for data exploration and operational reporting. SeekTable is available both as a cloud service and a self-hosted version. SeekTable reports may be embedded into any web-app.
Features:
- Business users-friendly reports builder.
- Powerful report parameters for SQL filtering and report-specific query customizations.
- Can connect to ClickHouse both with a native TCP/IP endpoint and a HTTP(S) interface (2 different drivers).
- It is possible to use all power of CH SQL dialect in dimensions/measures definitions
- [Web API](https://www.seektable.com/help/web-api-integration) for automated reports generation.
- Supports reports development flow with account data [backup/restore](https://www.seektable.com/help/self-hosted-backup-restore), data models (cubes) / reports configuration is a human-readable XML and can be stored under version control.
SeekTable is [free](https://www.seektable.com/help/cloud-pricing) for personal/individual usage.
[How to configure ClickHouse connection in SeekTable.](https://www.seektable.com/help/clickhouse-pivot-table)
[Original article](https://clickhouse.tech/docs/en/interfaces/third-party/gui/) <!--hide-->

View File

@ -1,6 +1,6 @@
# system.data_type_families {#system_tables-data_type_families}
Contains information about supported [data types](../../sql-reference/data-types/).
Contains information about supported [data types](../../sql-reference/data-types/index.md).
Columns:

View File

@ -76,6 +76,6 @@ last_postpone_time: 1970-01-01 03:00:00
**See Also**
- [Managing ReplicatedMergeTree Tables](../../sql-reference/statements/system.md/#query-language-system-replicated)
- [Managing ReplicatedMergeTree Tables](../../sql-reference/statements/system.md#query-language-system-replicated)
[Original article](https://clickhouse.tech/docs/en/operations/system_tables/replication_queue) <!--hide-->

View File

@ -250,4 +250,3 @@ FROM people
```
[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/combinators/) <!--hide-->

View File

@ -59,4 +59,3 @@ SELECT groupArray(y) FROM t_null_big
`groupArray` does not include `NULL` in the resulting array.
[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/) <!--hide-->

View File

@ -254,8 +254,8 @@ windowFunnel(window, [mode])(timestamp, cond1, cond2, ..., condN)
**Parameters**
- `window` — Length of the sliding window. The unit of `window` depends on the `timestamp` itself and varies. Determined using the expression `timestamp of cond2 <= timestamp of cond1 + window`.
- `mode` - It is an optional argument.
- `'strict'` - When the `'strict'` is set, the windowFunnel() applies conditions only for the unique values.
- `mode` It is an optional argument.
- `'strict'` When the `'strict'` is set, the windowFunnel() applies conditions only for the unique values.
**Returned value**
@ -336,14 +336,14 @@ retention(cond1, cond2, ..., cond32);
**Arguments**
- `cond`an expression that returns a `UInt8` result (1 or 0).
- `cond`An expression that returns a `UInt8` result (1 or 0).
**Returned value**
The array of 1 or 0.
- 1 — condition was met for the event.
- 0 — condition wasnt met for the event.
- 1 — Condition was met for the event.
- 0 — Condition wasnt met for the event.
Type: `UInt8`.
@ -500,7 +500,6 @@ Problem: Generate a report that shows only keywords that produced at least 5 uni
Solution: Write in the GROUP BY query SearchPhrase HAVING uniqUpTo(4)(UserID) >= 5
```
[Original article](https://clickhouse.tech/docs/en/query_language/agg_functions/parametric_functions/) <!--hide-->
## sumMapFiltered(keys_to_keep)(keys, values) {#summapfilteredkeys-to-keepkeys-values}

View File

@ -7,6 +7,7 @@ toc_priority: 1
Counts the number of rows or not-NULL values.
ClickHouse supports the following syntaxes for `count`:
- `count(expr)` or `COUNT(DISTINCT expr)`.
- `count()` or `COUNT(*)`. The `count()` syntax is ClickHouse-specific.

View File

@ -9,7 +9,7 @@ Inserts a value into the array at the specified position.
**Syntax**
``` sql
groupArrayInsertAt(default_x, size)(x, pos);
groupArrayInsertAt(default_x, size)(x, pos)
```
If in one query several values are inserted into the same position, the function behaves in the following ways:
@ -21,8 +21,8 @@ If in one query several values are inserted into the same position, the function
- `x` — Value to be inserted. [Expression](../../../sql-reference/syntax.md#syntax-expressions) resulting in one of the [supported data types](../../../sql-reference/data-types/index.md).
- `pos` — Position at which the specified element `x` is to be inserted. Index numbering in the array starts from zero. [UInt32](../../../sql-reference/data-types/int-uint.md#uint-ranges).
- `default_x`— Default value for substituting in empty positions. Optional parameter. [Expression](../../../sql-reference/syntax.md#syntax-expressions) resulting in the data type configured for the `x` parameter. If `default_x` is not defined, the [default values](../../../sql-reference/statements/create/table.md#create-default-values) are used.
- `size`— Length of the resulting array. Optional parameter. When using this parameter, the default value `default_x` must be specified. [UInt32](../../../sql-reference/data-types/int-uint.md#uint-ranges).
- `default_x` — Default value for substituting in empty positions. Optional parameter. [Expression](../../../sql-reference/syntax.md#syntax-expressions) resulting in the data type configured for the `x` parameter. If `default_x` is not defined, the [default values](../../../sql-reference/statements/create/table.md#create-default-values) are used.
- `size` — Length of the resulting array. Optional parameter. When using this parameter, the default value `default_x` must be specified. [UInt32](../../../sql-reference/data-types/int-uint.md#uint-ranges).
**Returned value**

View File

@ -14,7 +14,7 @@ groupBitmapOr(expr)
`expr` An expression that results in `AggregateFunction(groupBitmap, UInt*)` type.
**Return value**
**Returned value**
Value of the `UInt64` type.

View File

@ -14,7 +14,7 @@ groupBitmapOr(expr)
`expr` An expression that results in `AggregateFunction(groupBitmap, UInt*)` type.
**Return value**
**Returned value**
Value of the `UInt64` type.

View File

@ -14,7 +14,7 @@ groupBitOr(expr)
`expr` An expression that results in `UInt*` type.
**Return value**
**Returned value**
Value of the `UInt*` type.

View File

@ -10,7 +10,7 @@ Use it for tests or to process columns of types `AggregateFunction` and `Aggrega
**Syntax**
``` sql
initializeAggregation (aggregate_function, column_1, column_2);
initializeAggregation (aggregate_function, column_1, column_2)
```
**Arguments**

View File

@ -21,5 +21,5 @@ The kurtosis of the given distribution. Type — [Float64](../../../sql-referenc
**Example**
``` sql
SELECT kurtPop(value) FROM series_with_value_column
SELECT kurtPop(value) FROM series_with_value_column;
```

View File

@ -23,5 +23,5 @@ The kurtosis of the given distribution. Type — [Float64](../../../sql-referenc
**Example**
``` sql
SELECT kurtSamp(value) FROM series_with_value_column
SELECT kurtSamp(value) FROM series_with_value_column;
```

View File

@ -27,7 +27,7 @@ The null hypothesis is that two populations are stochastically equal. Also one-s
- `'two-sided'`;
- `'greater'`;
- `'less'`.
- `continuity_correction` - if not 0 then continuity correction in the normal approximation for the p-value is applied. (Optional, default: 1.) [UInt64](../../../sql-reference/data-types/int-uint.md).
- `continuity_correction` if not 0 then continuity correction in the normal approximation for the p-value is applied. (Optional, default: 1.) [UInt64](../../../sql-reference/data-types/int-uint.md).
**Returned values**

View File

@ -21,5 +21,5 @@ The skewness of the given distribution. Type — [Float64](../../../sql-referenc
**Example**
``` sql
SELECT skewPop(value) FROM series_with_value_column
SELECT skewPop(value) FROM series_with_value_column;
```

View File

@ -23,5 +23,5 @@ The skewness of the given distribution. Type — [Float64](../../../sql-referenc
**Example**
``` sql
SELECT skewSamp(value) FROM series_with_value_column
SELECT skewSamp(value) FROM series_with_value_column;
```

View File

@ -18,8 +18,8 @@ The null hypothesis is that means of populations are equal. Normal distribution
**Arguments**
- `sample_data`sample data. [Integer](../../../sql-reference/data-types/int-uint.md), [Float](../../../sql-reference/data-types/float.md) or [Decimal](../../../sql-reference/data-types/decimal.md).
- `sample_index`sample index. [Integer](../../../sql-reference/data-types/int-uint.md).
- `sample_data`Sample data. [Integer](../../../sql-reference/data-types/int-uint.md), [Float](../../../sql-reference/data-types/float.md) or [Decimal](../../../sql-reference/data-types/decimal.md).
- `sample_index`Sample index. [Integer](../../../sql-reference/data-types/int-uint.md).
**Returned values**

View File

@ -18,13 +18,13 @@ We recommend using the `N < 10` value; performance is reduced with large `N` val
**Arguments**
- N is the number of elements to return.
- `N` The number of elements to return.
If the parameter is omitted, default value 10 is used.
**Arguments**
- x The value to calculate frequency.
- `x` The value to calculate frequency.
**Example**

View File

@ -18,7 +18,7 @@ topKWeighted(N)(x, weight)
**Arguments**
- `x` The value.
- `x` The value.
- `weight` — The weight. [UInt8](../../../sql-reference/data-types/int-uint.md).
**Returned value**

View File

@ -18,8 +18,8 @@ The null hypothesis is that means of populations are equal. Normal distribution
**Arguments**
- `sample_data`sample data. [Integer](../../../sql-reference/data-types/int-uint.md), [Float](../../../sql-reference/data-types/float.md) or [Decimal](../../../sql-reference/data-types/decimal.md).
- `sample_index`sample index. [Integer](../../../sql-reference/data-types/int-uint.md).
- `sample_data`Sample data. [Integer](../../../sql-reference/data-types/int-uint.md), [Float](../../../sql-reference/data-types/float.md) or [Decimal](../../../sql-reference/data-types/decimal.md).
- `sample_index`Sample index. [Integer](../../../sql-reference/data-types/int-uint.md).
**Returned values**

View File

@ -65,4 +65,3 @@ For our example, the structure of dictionary can be the following:
</dictionary>
```
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_hierarchical/) <!--hide-->

View File

@ -445,4 +445,3 @@ Other types are not supported yet. The function returns the attribute for the pr
Data must completely fit into RAM.
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_layout/) <!--hide-->

View File

@ -19,6 +19,8 @@ Example of settings:
</dictionary>
```
or
``` sql
CREATE DICTIONARY (...)
...
@ -58,7 +60,7 @@ When upgrading the dictionaries, the ClickHouse server applies different logic d
- For MySQL source, the time of modification is checked using a `SHOW TABLE STATUS` query (in case of MySQL 8 you need to disable meta-information caching in MySQL by `set global information_schema_stats_expiry=0`.
- Dictionaries from other sources are updated every time by default.
For other sources (ODBC, ClickHouse, etc), you can set up a query that will update the dictionaries only if they really changed, rather than each time. To do this, follow these steps:
For other sources (ODBC, PostgreSQL, ClickHouse, etc), you can set up a query that will update the dictionaries only if they really changed, rather than each time. To do this, follow these steps:
- The dictionary table must have a field that always changes when the source data is updated.
- The settings of the source must specify a query that retrieves the changing field. The ClickHouse server interprets the query result as a row, and if this row has changed relative to its previous state, the dictionary is updated. Specify the query in the `<invalidate_query>` field in the settings for the [source](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-sources.md).
@ -84,4 +86,3 @@ SOURCE(ODBC(... invalidate_query 'SELECT update_time FROM dictionary_source wher
...
```
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_lifetime/) <!--hide-->

View File

@ -65,6 +65,7 @@ Types of sources (`source_type`):
- DBMS
- [ODBC](#dicts-external_dicts_dict_sources-odbc)
- [MySQL](#dicts-external_dicts_dict_sources-mysql)
- [PostgreSQL](#dicts-external_dicts_dict_sources-postgresql)
- [ClickHouse](#dicts-external_dicts_dict_sources-clickhouse)
- [MongoDB](#dicts-external_dicts_dict_sources-mongodb)
- [Redis](#dicts-external_dicts_dict_sources-redis)
@ -659,7 +660,7 @@ Example of settings:
Setting fields:
- `host` The Cassandra host or comma-separated list of hosts.
- `port` The port on the Cassandra servers. If not specified, default port is used.
- `port` The port on the Cassandra servers. If not specified, default port 9042 is used.
- `user` Name of the Cassandra user.
- `password` Password of the Cassandra user.
- `keyspace` Name of the keyspace (database).
@ -673,4 +674,52 @@ Default value is 1 (the first key column is a partition key and other key column
- `where` Optional selection criteria.
- `max_threads` The maximum number of threads to use for loading data from multiple partitions in compose key dictionaries.
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_sources/) <!--hide-->
### PosgreSQL {#dicts-external_dicts_dict_sources-postgresql}
Example of settings:
``` xml
<source>
<postgresql>
<port>5432</port>
<user>clickhouse</user>
<password>qwerty</password>
<db>db_name</db>
<table>table_name</table>
<where>id=10</where>
<invalidate_query>SQL_QUERY</invalidate_query>
</postgresql>
</source>
```
or
``` sql
SOURCE(POSTGRESQL(
port 5432
host 'postgresql-hostname'
user 'postgres_user'
password 'postgres_password'
db 'db_name'
table 'table_name'
replica(host 'example01-1' port 5432 priority 1)
replica(host 'example01-2' port 5432 priority 2)
where 'id=10'
invalidate_query 'SQL_QUERY'
))
```
Setting fields:
- `host` The host on the PostgreSQL server. You can specify it for all replicas, or for each one individually (inside `<replica>`).
- `port` The port on the PostgreSQL server. You can specify it for all replicas, or for each one individually (inside `<replica>`).
- `user` Name of the PostgreSQL user. You can specify it for all replicas, or for each one individually (inside `<replica>`).
- `password` Password of the PostgreSQL user. You can specify it for all replicas, or for each one individually (inside `<replica>`).
- `replica` Section of replica configurations. There can be multiple sections.
- `replica/host` The PostgreSQL host.
- `replica/port` The PostgreSQL port.
- `replica/priority` The replica priority. When attempting to connect, ClickHouse traverses the replicas in order of priority. The lower the number, the higher the priority.
- `db` Name of the database.
- `table` Name of the table.
- `where` The selection criteria. The syntax for conditions is the same as for `WHERE` clause in PostgreSQL, for example, `id > 10 AND id < 20`. Optional parameter.
- `invalidate_query` Query for checking the dictionary status. Optional parameter. Read more in the section [Updating dictionaries](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md).

View File

@ -170,4 +170,3 @@ Configuration fields:
- [Functions for working with external dictionaries](../../../sql-reference/functions/ext-dict-functions.md).
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict_structure/) <!--hide-->

View File

@ -48,4 +48,3 @@ LIFETIME(...) -- Lifetime of dictionary in memory
- [structure](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md) — Structure of the dictionary . A key and attributes that can be retrieved by this key.
- [lifetime](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-lifetime.md) — Frequency of dictionary updates.
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts_dict/) <!--hide-->

View File

@ -57,4 +57,3 @@ You can [configure](../../../sql-reference/dictionaries/external-dictionaries/ex
- [Dictionary Key and Fields](../../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md)
- [Functions for Working with External Dictionaries](../../../sql-reference/functions/ext-dict-functions.md)
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/external_dicts/) <!--hide-->

View File

@ -17,4 +17,3 @@ ClickHouse supports:
- [Built-in dictionaries](../../sql-reference/dictionaries/internal-dicts.md#internal_dicts) with a specific [set of functions](../../sql-reference/functions/ym-dict-functions.md).
- [Plug-in (external) dictionaries](../../sql-reference/dictionaries/external-dictionaries/external-dicts.md#dicts-external-dicts) with a [set of functions](../../sql-reference/functions/ext-dict-functions.md).
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/) <!--hide-->

View File

@ -50,4 +50,3 @@ We recommend periodically updating the dictionaries with the geobase. During an
There are also functions for working with OS identifiers and Yandex.Metrica search engines, but they shouldnt be used.
[Original article](https://clickhouse.tech/docs/en/query_language/dicts/internal_dicts/) <!--hide-->

View File

@ -82,4 +82,3 @@ An exception is thrown when dividing by zero or when dividing a minimal negative
Returns the least common multiple of the numbers.
An exception is thrown when dividing by zero or when dividing a minimal negative number by minus one.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/arithmetic_functions/) <!--hide-->

View File

@ -376,7 +376,7 @@ arrayPopBack(array)
**Example**
``` sql
SELECT arrayPopBack([1, 2, 3]) AS res
SELECT arrayPopBack([1, 2, 3]) AS res;
```
``` text
@ -400,7 +400,7 @@ arrayPopFront(array)
**Example**
``` sql
SELECT arrayPopFront([1, 2, 3]) AS res
SELECT arrayPopFront([1, 2, 3]) AS res;
```
``` text
@ -425,7 +425,7 @@ arrayPushBack(array, single_value)
**Example**
``` sql
SELECT arrayPushBack(['a'], 'b') AS res
SELECT arrayPushBack(['a'], 'b') AS res;
```
``` text
@ -450,7 +450,7 @@ arrayPushFront(array, single_value)
**Example**
``` sql
SELECT arrayPushFront(['b'], 'a') AS res
SELECT arrayPushFront(['b'], 'a') AS res;
```
``` text
@ -482,7 +482,7 @@ An array of length `size`.
**Examples of calls**
``` sql
SELECT arrayResize([1], 3)
SELECT arrayResize([1], 3);
```
``` text
@ -492,7 +492,7 @@ SELECT arrayResize([1], 3)
```
``` sql
SELECT arrayResize([1], 3, NULL)
SELECT arrayResize([1], 3, NULL);
```
``` text
@ -513,12 +513,12 @@ arraySlice(array, offset[, length])
- `array` Array of data.
- `offset` Indent from the edge of the array. A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the array items begins with 1.
- `length` - The length of the required slice. If you specify a negative value, the function returns an open slice `[offset, array_length - length)`. If you omit the value, the function returns the slice `[offset, the_end_of_array]`.
- `length` The length of the required slice. If you specify a negative value, the function returns an open slice `[offset, array_length - length)`. If you omit the value, the function returns the slice `[offset, the_end_of_array]`.
**Example**
``` sql
SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res
SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res;
```
``` text
@ -766,7 +766,7 @@ Type: [UInt\*](https://clickhouse.tech/docs/en/data_types/int_uint/#uint-ranges)
Query:
``` sql
SELECT arrayDifference([1, 2, 3, 4])
SELECT arrayDifference([1, 2, 3, 4]);
```
Result:
@ -782,7 +782,7 @@ Example of the overflow due to result type Int64:
Query:
``` sql
SELECT arrayDifference([0, 10000000000000000000])
SELECT arrayDifference([0, 10000000000000000000]);
```
Result:
@ -816,7 +816,7 @@ Returns an array containing the distinct elements.
Query:
``` sql
SELECT arrayDistinct([1, 2, 2, 3, 1])
SELECT arrayDistinct([1, 2, 2, 3, 1]);
```
Result:
@ -883,7 +883,7 @@ arrayReduce(agg_func, arr1, arr2, ..., arrN)
Query:
``` sql
SELECT arrayReduce('max', [1, 2, 3])
SELECT arrayReduce('max', [1, 2, 3]);
```
Result:
@ -899,7 +899,7 @@ If an aggregate function takes multiple arguments, then this function must be ap
Query:
``` sql
SELECT arrayReduce('maxIf', [3, 5], [1, 0])
SELECT arrayReduce('maxIf', [3, 5], [1, 0]);
```
Result:
@ -915,7 +915,7 @@ Example with a parametric aggregate function:
Query:
``` sql
SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
SELECT arrayReduce('uniqUpTo(3)', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
```
Result:
@ -1014,7 +1014,7 @@ Alias: `flatten`.
**Examples**
``` sql
SELECT flatten([[[1]], [[2], [3]]])
SELECT flatten([[[1]], [[2], [3]]]);
```
``` text
@ -1048,7 +1048,7 @@ Type: `Array`.
Query:
``` sql
SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3])
SELECT arrayCompact([1, 1, nan, nan, 2, 3, 3, 3]);
```
Result:
@ -1086,7 +1086,7 @@ Type: [Array](../../sql-reference/data-types/array.md).
Query:
``` sql
SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1])
SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]);
```
Result:
@ -1108,17 +1108,20 @@ arrayAUC(arr_scores, arr_labels)
```
**Arguments**
- `arr_scores` — scores prediction model gives.
- `arr_labels` — labels of samples, usually 1 for positive sample and 0 for negtive sample.
**Returned value**
Returns AUC value with type Float64.
**Example**
Query:
``` sql
select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1])
select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]);
```
Result:
@ -1541,4 +1544,3 @@ SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res
```
Note that the `arraySumNonNegative` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You can pass a lambda function to it as the first argument.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/array_functions/) <!--hide-->

View File

@ -32,4 +32,3 @@ SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src
└─────┴───────────┴─────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/array_join/) <!--hide-->

View File

@ -37,8 +37,8 @@ SELECT bitTest(number, index)
**Arguments**
- `number` integer number.
- `index` position of bit.
- `number` Integer number.
- `index` Position of bit.
**Returned values**
@ -53,7 +53,7 @@ For example, the number 43 in base-2 (binary) numeral system is 101011.
Query:
``` sql
SELECT bitTest(43, 1)
SELECT bitTest(43, 1);
```
Result:
@ -69,7 +69,7 @@ Another example:
Query:
``` sql
SELECT bitTest(43, 2)
SELECT bitTest(43, 2);
```
Result:
@ -102,8 +102,8 @@ SELECT bitTestAll(number, index1, index2, index3, index4, ...)
**Arguments**
- `number` integer number.
- `index1`, `index2`, `index3`, `index4` positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) is true if and only if all of its positions are true (`index1` ⋀ `index2`, ⋀ `index3``index4`).
- `number` Integer number.
- `index1`, `index2`, `index3`, `index4` Positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) is true if and only if all of its positions are true (`index1` ⋀ `index2`, ⋀ `index3``index4`).
**Returned values**
@ -118,7 +118,7 @@ For example, the number 43 in base-2 (binary) numeral system is 101011.
Query:
``` sql
SELECT bitTestAll(43, 0, 1, 3, 5)
SELECT bitTestAll(43, 0, 1, 3, 5);
```
Result:
@ -134,7 +134,7 @@ Another example:
Query:
``` sql
SELECT bitTestAll(43, 0, 1, 3, 5, 2)
SELECT bitTestAll(43, 0, 1, 3, 5, 2);
```
Result:
@ -167,8 +167,8 @@ SELECT bitTestAny(number, index1, index2, index3, index4, ...)
**Arguments**
- `number` integer number.
- `index1`, `index2`, `index3`, `index4` positions of bit.
- `number` Integer number.
- `index1`, `index2`, `index3`, `index4` Positions of bit.
**Returned values**
@ -183,7 +183,7 @@ For example, the number 43 in base-2 (binary) numeral system is 101011.
Query:
``` sql
SELECT bitTestAny(43, 0, 2)
SELECT bitTestAny(43, 0, 2);
```
Result:
@ -199,7 +199,7 @@ Another example:
Query:
``` sql
SELECT bitTestAny(43, 4, 2)
SELECT bitTestAny(43, 4, 2);
```
Result:
@ -239,7 +239,7 @@ Take for example the number 333. Its binary representation: 0000000101001101.
Query:
``` sql
SELECT bitCount(333)
SELECT bitCount(333);
```
Result:
@ -250,4 +250,3 @@ Result:
└───────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/bit_functions/) <!--hide-->

View File

@ -23,12 +23,12 @@ bitmapBuild(array)
**Arguments**
- `array` unsigned integer array.
- `array` Unsigned integer array.
**Example**
``` sql
SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res)
SELECT bitmapBuild([1, 2, 3, 4, 5]) AS res, toTypeName(res);
```
``` text
@ -47,12 +47,12 @@ bitmapToArray(bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res
SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res;
```
``` text
@ -72,13 +72,13 @@ bitmapSubsetInRange(bitmap, range_start, range_end)
**Arguments**
- `bitmap` [Bitmap object](#bitmap_functions-bitmapbuild).
- `range_start` range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
- `range_end` range end point(excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md).
- `range_start` Range start point. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
- `range_end` Range end point (excluded). Type: [UInt32](../../sql-reference/data-types/int-uint.md).
**Example**
``` sql
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res;
```
``` text
@ -114,7 +114,7 @@ Type: `Bitmap object`.
Query:
``` sql
SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
SELECT bitmapToArray(bitmapSubsetLimit(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res;
```
Result:
@ -148,7 +148,7 @@ Type: `UInt8`.
**Example**
``` sql
SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res
SELECT bitmapContains(bitmapBuild([1,5,7,9]), toUInt32(9)) AS res;
```
``` text
@ -169,7 +169,7 @@ If you are sure that `bitmap2` contains strictly one element, consider using the
**Arguments**
- `bitmap*` bitmap object.
- `bitmap*` Bitmap object.
**Return values**
@ -179,7 +179,7 @@ If you are sure that `bitmap2` contains strictly one element, consider using the
**Example**
``` sql
SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res
SELECT bitmapHasAny(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res;
```
``` text
@ -199,12 +199,12 @@ bitmapHasAll(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res
SELECT bitmapHasAll(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res;
```
``` text
@ -223,12 +223,12 @@ bitmapCardinality(bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res
SELECT bitmapCardinality(bitmapBuild([1, 2, 3, 4, 5])) AS res;
```
``` text
@ -245,17 +245,19 @@ Retrun the smallest value of type UInt64 in the set, UINT32_MAX if the set is em
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res
SELECT bitmapMin(bitmapBuild([1, 2, 3, 4, 5])) AS res;
```
``` text
┌─res─┐
│ 1 │
└─────┘
```
## bitmapMax {#bitmapmax}
@ -265,17 +267,19 @@ Retrun the greatest value of type UInt64 in the set, 0 if the set is empty.
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res
SELECT bitmapMax(bitmapBuild([1, 2, 3, 4, 5])) AS res;
```
``` text
┌─res─┐
│ 5 │
└─────┘
```
## bitmapTransform {#bitmaptransform}
@ -285,19 +289,21 @@ Transform an array of values in a bitmap to another array of values, the result
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
- `from_array` UInt32 array. For idx in range \[0, from_array.size()), if bitmap contains from_array\[idx\], then replace it with to_array\[idx\]. Note that the result depends on array ordering if there are common elements between from_array and to_array.
- `to_array` UInt32 array, its size shall be the same to from_array.
**Example**
``` sql
SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res
SELECT bitmapToArray(bitmapTransform(bitmapBuild([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), cast([5,999,2] as Array(UInt32)), cast([2,888,20] as Array(UInt32)))) AS res;
```
``` text
┌─res───────────────────┐
│ [1,3,4,6,7,8,9,10,20] │
└───────────────────────┘
```
## bitmapAnd {#bitmapand}
@ -309,12 +315,12 @@ bitmapAnd(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res
SELECT bitmapToArray(bitmapAnd(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res;
```
``` text
@ -333,12 +339,12 @@ bitmapOr(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res
SELECT bitmapToArray(bitmapOr(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res;
```
``` text
@ -357,12 +363,12 @@ bitmapXor(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res
SELECT bitmapToArray(bitmapXor(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res;
```
``` text
@ -381,12 +387,12 @@ bitmapAndnot(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
``` sql
SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res
SELECT bitmapToArray(bitmapAndnot(bitmapBuild([1,2,3]),bitmapBuild([3,4,5]))) AS res;
```
``` text
@ -405,7 +411,7 @@ bitmapAndCardinality(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
@ -429,7 +435,7 @@ bitmapOrCardinality(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
@ -453,7 +459,7 @@ bitmapXorCardinality(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
@ -477,7 +483,7 @@ bitmapAndnotCardinality(bitmap,bitmap)
**Arguments**
- `bitmap` bitmap object.
- `bitmap` Bitmap object.
**Example**
@ -491,4 +497,3 @@ SELECT bitmapAndnotCardinality(bitmapBuild([1,2,3]),bitmapBuild([3,4,5])) AS res
└─────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/bitmap_functions/) <!--hide-->

View File

@ -32,4 +32,3 @@ Strings are compared by bytes. A shorter string is smaller than all strings that
## greaterOrEquals, \>= operator {#function-greaterorequals}
[Original article](https://clickhouse.tech/docs/en/query_language/functions/comparison_functions/) <!--hide-->

View File

@ -20,8 +20,8 @@ If the condition `cond` evaluates to a non-zero value, returns the result of the
**Arguments**
- `cond` The condition for evaluation that can be zero or not. The type is UInt8, Nullable(UInt8) or NULL.
- `then` - The expression to return if condition is met.
- `else` - The expression to return if condition is not met.
- `then` The expression to return if condition is met.
- `else` The expression to return if condition is not met.
**Returned values**
@ -32,7 +32,7 @@ The function executes `then` and `else` expressions and returns its result, depe
Query:
``` sql
SELECT if(1, plus(2, 2), plus(2, 6))
SELECT if(1, plus(2, 2), plus(2, 6));
```
Result:
@ -46,7 +46,7 @@ Result:
Query:
``` sql
SELECT if(0, plus(2, 2), plus(2, 6))
SELECT if(0, plus(2, 2), plus(2, 6));
```
Result:
@ -202,4 +202,3 @@ FROM LEFT_RIGHT
└──────┴───────┴──────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/conditional_functions/) <!--hide-->

View File

@ -1070,4 +1070,3 @@ Result:
└────────────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/date_time_functions/) <!--hide-->

View File

@ -30,7 +30,7 @@ Type: `String`.
Query:
``` sql
SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello
SELECT char(104.1, 101, 108.9, 108.9, 111) AS hello;
```
Result:
@ -172,4 +172,3 @@ Accepts an integer. Returns a string containing the list of powers of two that t
Accepts an integer. Returns an array of UInt64 numbers containing the list of powers of two that total the source number when summed. Numbers in the array are in ascending order.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/encoding_functions/) <!--hide-->

View File

@ -203,4 +203,3 @@ dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr)
ClickHouse throws an exception if it cannot parse the value of the attribute or the value doesnt match the attribute data type.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/ext_dict_functions/) <!--hide-->

View File

@ -38,7 +38,7 @@ Input table
Query
``` sql
SELECT x FROM t_null WHERE isNull(y)
SELECT x FROM t_null WHERE isNull(y);
```
``` text
@ -78,7 +78,7 @@ Input table
Query
``` sql
SELECT x FROM t_null WHERE isNotNull(y)
SELECT x FROM t_null WHERE isNotNull(y);
```
``` text
@ -120,7 +120,7 @@ The `mail` and `phone` fields are of type String, but the `icq` field is `UInt32
Get the first available contact method for the customer from the contact list:
``` sql
SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook
SELECT coalesce(mail, phone, CAST(icq,'Nullable(String)')) FROM aBook;
```
``` text
@ -151,7 +151,7 @@ ifNull(x,alt)
**Example**
``` sql
SELECT ifNull('a', 'b')
SELECT ifNull('a', 'b');
```
``` text
@ -161,7 +161,7 @@ SELECT ifNull('a', 'b')
```
``` sql
SELECT ifNull(NULL, 'b')
SELECT ifNull(NULL, 'b');
```
``` text
@ -190,7 +190,7 @@ nullIf(x, y)
**Example**
``` sql
SELECT nullIf(1, 1)
SELECT nullIf(1, 1);
```
``` text
@ -200,7 +200,7 @@ SELECT nullIf(1, 1)
```
``` sql
SELECT nullIf(1, 2)
SELECT nullIf(1, 2);
```
``` text
@ -231,7 +231,7 @@ assumeNotNull(x)
Consider the `t_null` table.
``` sql
SHOW CREATE TABLE t_null
SHOW CREATE TABLE t_null;
```
``` text
@ -250,7 +250,7 @@ SHOW CREATE TABLE t_null
Apply the `assumeNotNull` function to the `y` column.
``` sql
SELECT assumeNotNull(y) FROM t_null
SELECT assumeNotNull(y) FROM t_null;
```
``` text
@ -261,7 +261,7 @@ SELECT assumeNotNull(y) FROM t_null
```
``` sql
SELECT toTypeName(assumeNotNull(y)) FROM t_null
SELECT toTypeName(assumeNotNull(y)) FROM t_null;
```
``` text
@ -290,7 +290,7 @@ toNullable(x)
**Example**
``` sql
SELECT toTypeName(10)
SELECT toTypeName(10);
```
``` text
@ -300,7 +300,7 @@ SELECT toTypeName(10)
```
``` sql
SELECT toTypeName(toNullable(10))
SELECT toTypeName(toNullable(10));
```
``` text
@ -309,4 +309,3 @@ SELECT toTypeName(toNullable(10))
└────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/functions_for_nulls/) <!--hide-->

View File

@ -29,7 +29,7 @@ geohashEncode(longitude, latitude, [precision])
**Example**
``` sql
SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res
SELECT geohashEncode(-5.60302734375, 42.593994140625, 0) AS res;
```
``` text
@ -53,7 +53,7 @@ Decodes any [geohash](#geohash)-encoded string into longitude and latitude.
**Example**
``` sql
SELECT geohashDecode('ezs42') AS res
SELECT geohashDecode('ezs42') AS res;
```
``` text
@ -98,8 +98,9 @@ Type: [Array](../../../sql-reference/data-types/array.md)([String](../../../sql-
Query:
``` sql
SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos
SELECT geohashesInBox(24.48, 40.56, 24.785, 40.81, 4) AS thasos;
```
Result:
``` text

View File

@ -40,8 +40,9 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3IsValid(630814730351855103) as h3IsValid
SELECT h3IsValid(630814730351855103) as h3IsValid;
```
Result:
``` text
@ -76,8 +77,9 @@ Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT h3GetResolution(639821929606596015) as resolution
SELECT h3GetResolution(639821929606596015) as resolution;
```
Result:
``` text
@ -109,8 +111,9 @@ h3EdgeAngle(resolution)
Query:
``` sql
SELECT h3EdgeAngle(10) as edgeAngle
SELECT h3EdgeAngle(10) as edgeAngle;
```
Result:
``` text
@ -142,8 +145,9 @@ h3EdgeLengthM(resolution)
Query:
``` sql
SELECT h3EdgeLengthM(15) as edgeLengthM
SELECT h3EdgeLengthM(15) as edgeLengthM;
```
Result:
``` text
@ -180,7 +184,7 @@ Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index
SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index;
```
Result:
@ -217,8 +221,9 @@ Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-
Query:
``` sql
SELECT arrayJoin(h3kRing(644325529233966508, 1)) AS h3index
SELECT arrayJoin(h3kRing(644325529233966508, 1)) AS h3index;
```
Result:
``` text

View File

@ -29,7 +29,7 @@ A [UInt64](../../sql-reference/data-types/int-uint.md) data type hash value.
**Example**
``` sql
SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type
SELECT halfMD5(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS halfMD5hash, toTypeName(halfMD5hash) AS type;
```
``` text
@ -72,7 +72,7 @@ A [UInt64](../../sql-reference/data-types/int-uint.md) data type hash value.
**Example**
``` sql
SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type
SELECT sipHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS SipHash, toTypeName(SipHash) AS type;
```
``` text
@ -110,7 +110,7 @@ A [UInt64](../../sql-reference/data-types/int-uint.md) data type hash value.
Call example:
``` sql
SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type
SELECT cityHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS CityHash, toTypeName(CityHash) AS type;
```
``` text
@ -177,7 +177,7 @@ A [UInt64](../../sql-reference/data-types/int-uint.md) data type hash value.
**Example**
``` sql
SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type
SELECT farmHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS FarmHash, toTypeName(FarmHash) AS type;
```
``` text
@ -193,7 +193,7 @@ Calculates [JavaHash](http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/478a4add97
**Syntax**
``` sql
SELECT javaHash('');
SELECT javaHash('')
```
**Returned value**
@ -241,7 +241,7 @@ Correct query with UTF-16LE encoded string.
Query:
``` sql
SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'))
SELECT javaHashUTF16LE(convertCharset('test', 'utf-8', 'utf-16le'));
```
Result:
@ -257,7 +257,7 @@ Result:
Calculates `HiveHash` from a string.
``` sql
SELECT hiveHash('');
SELECT hiveHash('')
```
This is just [JavaHash](#hash_functions-javahash) with zeroed out sign bit. This function is used in [Apache Hive](https://en.wikipedia.org/wiki/Apache_Hive) for versions before 3.0. This hash function is neither fast nor having a good quality. The only reason to use it is when this algorithm is already used in another system and you have to calculate exactly the same result.
@ -303,7 +303,7 @@ A [UInt64](../../sql-reference/data-types/int-uint.md) data type hash value.
**Example**
``` sql
SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type
SELECT metroHash64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MetroHash, toTypeName(MetroHash) AS type;
```
``` text
@ -339,7 +339,7 @@ Both functions take a variable number of input parameters. Arguments can be any
**Example**
``` sql
SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type
SELECT murmurHash2_64(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash2, toTypeName(MurmurHash2) AS type;
```
``` text
@ -355,7 +355,7 @@ Calculates a 64-bit [MurmurHash2](https://github.com/aappleby/smhasher) hash val
**Syntax**
``` sql
gccMurmurHash(par1, ...);
gccMurmurHash(par1, ...)
```
**Arguments**
@ -407,7 +407,7 @@ Both functions take a variable number of input parameters. Arguments can be any
**Example**
``` sql
SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type
SELECT murmurHash3_32(array('e','x','a'), 'mple', 10, toDateTime('2019-06-15 23:00:00')) AS MurmurHash3, toTypeName(MurmurHash3) AS type;
```
``` text
@ -435,7 +435,7 @@ A [FixedString(16)](../../sql-reference/data-types/fixedstring.md) data type has
**Example**
``` sql
SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type
SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3) AS type;
```
``` text
@ -449,11 +449,11 @@ SELECT murmurHash3_128('example_string') AS MurmurHash3, toTypeName(MurmurHash3)
Calculates `xxHash` from a string. It is proposed in two flavors, 32 and 64 bits.
``` sql
SELECT xxHash32('');
SELECT xxHash32('')
OR
SELECT xxHash64('');
SELECT xxHash64('')
```
**Returned value**
@ -482,4 +482,3 @@ Result:
- [xxHash](http://cyan4973.github.io/xxHash/).
[Original article](https://clickhouse.tech/docs/en/query_language/functions/hash_functions/) <!--hide-->

View File

@ -9,4 +9,3 @@ toc_title: IN Operator
See the section [IN operators](../../sql-reference/operators/in.md#select-in-operators).
[Original article](https://clickhouse.tech/docs/en/query_language/functions/in_functions/) <!--hide-->

View File

@ -84,4 +84,3 @@ Another example is the `hostName` function, which returns the name of the server
If a function in a query is performed on the requestor server, but you need to perform it on remote servers, you can wrap it in an any aggregate function or add it to a key in `GROUP BY`.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/) <!--hide-->

View File

@ -53,13 +53,13 @@ Type: [String](../../sql-reference/data-types/string.md).
Enabling introspection functions:
``` sql
SET allow_introspection_functions=1
SET allow_introspection_functions=1;
```
Selecting the first string from the `trace_log` system table:
``` sql
SELECT * FROM system.trace_log LIMIT 1 \G
SELECT * FROM system.trace_log LIMIT 1 \G;
```
``` text
@ -79,7 +79,7 @@ The `trace` field contains the stack trace at the moment of sampling.
Getting the source code filename and the line number for a single address:
``` sql
SELECT addressToLine(94784076370703) \G
SELECT addressToLine(94784076370703) \G;
```
``` text
@ -139,13 +139,13 @@ Type: [String](../../sql-reference/data-types/string.md).
Enabling introspection functions:
``` sql
SET allow_introspection_functions=1
SET allow_introspection_functions=1;
```
Selecting the first string from the `trace_log` system table:
``` sql
SELECT * FROM system.trace_log LIMIT 1 \G
SELECT * FROM system.trace_log LIMIT 1 \G;
```
``` text
@ -165,7 +165,7 @@ The `trace` field contains the stack trace at the moment of sampling.
Getting a symbol for a single address:
``` sql
SELECT addressToSymbol(94138803686098) \G
SELECT addressToSymbol(94138803686098) \G;
```
``` text
@ -236,13 +236,13 @@ Type: [String](../../sql-reference/data-types/string.md).
Enabling introspection functions:
``` sql
SET allow_introspection_functions=1
SET allow_introspection_functions=1;
```
Selecting the first string from the `trace_log` system table:
``` sql
SELECT * FROM system.trace_log LIMIT 1 \G
SELECT * FROM system.trace_log LIMIT 1 \G;
```
``` text
@ -262,7 +262,7 @@ The `trace` field contains the stack trace at the moment of sampling.
Getting a function name for a single address:
``` sql
SELECT demangle(addressToSymbol(94138803686098)) \G
SELECT demangle(addressToSymbol(94138803686098)) \G;
```
``` text
@ -335,6 +335,7 @@ Result:
│ 3878 │
└───────┘
```
## logTrace {#logtrace}
Emits trace log message to server log for each [Block](https://clickhouse.tech/docs/en/development/architecture/#block).
@ -369,4 +370,3 @@ Result:
└──────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/introspection/) <!--hide-->

View File

@ -60,7 +60,7 @@ Alias: `INET6_NTOA`.
Examples:
``` sql
SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr
SELECT IPv6NumToString(toFixedString(unhex('2A0206B8000000000000000000000011'), 16)) AS addr;
```
``` text
@ -164,7 +164,7 @@ Result:
└────────────┴──────────────────────────────────────┘
```
**See also**
**See Also**
- [cutIPv6](#cutipv6x-bytestocutforipv6-bytestocutforipv4).
@ -173,7 +173,7 @@ Result:
Takes a `UInt32` number. Interprets it as an IPv4 address in [big endian](https://en.wikipedia.org/wiki/Endianness). Returns a `FixedString(16)` value containing the IPv6 address in binary format. Examples:
``` sql
SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr
SELECT IPv6NumToString(IPv4ToIPv6(IPv4StringToNum('192.168.0.1'))) AS addr;
```
``` text
@ -206,7 +206,7 @@ SELECT
Accepts an IPv4 and an UInt8 value containing the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). Return a tuple with two IPv4 containing the lower range and the higher range of the subnet.
``` sql
SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16)
SELECT IPv4CIDRToRange(toIPv4('192.168.5.2'), 16);
```
``` text
@ -342,7 +342,7 @@ Type: [UInt8](../../sql-reference/data-types/int-uint.md).
Query:
```sql
SELECT addr, isIPv4String(addr) FROM ( SELECT ['0.0.0.0', '127.0.0.1', '::ffff:127.0.0.1'] AS addr ) ARRAY JOIN addr
SELECT addr, isIPv4String(addr) FROM ( SELECT ['0.0.0.0', '127.0.0.1', '::ffff:127.0.0.1'] AS addr ) ARRAY JOIN addr;
```
Result:
@ -380,7 +380,7 @@ Type: [UInt8](../../sql-reference/data-types/int-uint.md).
Query:
``` sql
SELECT addr, isIPv6String(addr) FROM ( SELECT ['::', '1111::ffff', '::ffff:127.0.0.1', '127.0.0.1'] AS addr ) ARRAY JOIN addr
SELECT addr, isIPv6String(addr) FROM ( SELECT ['::', '1111::ffff', '::ffff:127.0.0.1', '127.0.0.1'] AS addr ) ARRAY JOIN addr;
```
Result:
@ -394,4 +394,3 @@ Result:
└──────────────────┴────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/ip_address_functions/) <!--hide-->

View File

@ -199,7 +199,7 @@ Parses key-value pairs from a JSON where the values are of the given ClickHouse
Example:
``` sql
SELECT JSONExtractKeysAndValues('{"x": {"a": 5, "b": 7, "c": 11}}', 'x', 'Int8') = [('a',5),('b',7),('c',11)]
SELECT JSONExtractKeysAndValues('{"x": {"a": 5, "b": 7, "c": 11}}', 'x', 'Int8') = [('a',5),('b',7),('c',11)];
```
## JSONExtractRaw(json\[, indices_or_keys\]…) {#jsonextractrawjson-indices-or-keys}
@ -211,7 +211,7 @@ If the part does not exist or has a wrong type, an empty string will be returned
Example:
``` sql
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]'
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]';
```
## JSONExtractArrayRaw(json\[, indices_or_keys…\]) {#jsonextractarrayrawjson-indices-or-keys}
@ -223,7 +223,7 @@ If the part does not exist or isnt array, an empty array will be returned.
Example:
``` sql
SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']'
SELECT JSONExtractArrayRaw('{"a": "hello", "b": [-100, 200.0, "hello"]}', 'b') = ['-100', '200.0', '"hello"']';
```
## JSONExtractKeysAndValuesRaw {#json-extract-keys-and-values-raw}
@ -253,7 +253,7 @@ Type: [Array](../../sql-reference/data-types/array.md)([Tuple](../../sql-referen
Query:
``` sql
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}')
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}');
```
Result:
@ -267,7 +267,7 @@ Result:
Query:
``` sql
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}', 'b')
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}', 'b');
```
Result:
@ -281,7 +281,7 @@ Result:
Query:
``` sql
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}', -1, 'c')
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b":{"c": {"d": "hello", "f": "world"}}}', -1, 'c');
```
Result:
@ -292,4 +292,3 @@ Result:
└───────────────────────────────────────────────────────────────────────────────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/json_functions/) <!--hide-->

View File

@ -17,4 +17,3 @@ Zero as an argument is considered “false,” while any non-zero value is consi
## xor {#xor}
[Original article](https://clickhouse.tech/docs/en/query_language/functions/logical_functions/) <!--hide-->

View File

@ -9,7 +9,7 @@ toc_title: Machine Learning
Prediction using fitted regression models uses `evalMLMethod` function. See link in `linearRegression`.
## stochasticLinearRegressionn {#stochastic-linear-regression}
## stochasticLinearRegression {#stochastic-linear-regression}
The [stochasticLinearRegression](../../sql-reference/aggregate-functions/reference/stochasticlinearregression.md#agg_functions-stochasticlinearregression) aggregate function implements stochastic gradient descent method using linear model and MSE loss function. Uses `evalMLMethod` to predict on new data.
@ -36,14 +36,14 @@ bayesAB(distribution_name, higher_is_better, variant_names, x, y)
- `higher_is_better` — Boolean flag. [Boolean](../../sql-reference/data-types/boolean.md). Possible values:
- `0` - lower values are considered to be better than higher
- `1` - higher values are considered to be better than lower
- `0` lower values are considered to be better than higher
- `1` higher values are considered to be better than lower
- `variant_names` - Variant names. [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
- `variant_names` Variant names. [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
- `x` - Numbers of tests for the corresponding variants. [Array](../../sql-reference/data-types/array.md)([Float64](../../sql-reference/data-types/float.md)).
- `x` Numbers of tests for the corresponding variants. [Array](../../sql-reference/data-types/array.md)([Float64](../../sql-reference/data-types/float.md)).
- `y` - Numbers of successful tests for the corresponding variants. [Array](../../sql-reference/data-types/array.md)([Float64](../../sql-reference/data-types/float.md)).
- `y` Numbers of successful tests for the corresponding variants. [Array](../../sql-reference/data-types/array.md)([Float64](../../sql-reference/data-types/float.md)).
!!! note "Note"
All three arrays must have the same size. All `x` and `y` values must be non-negative constant numbers. `y` cannot be larger than `x`.
@ -51,8 +51,8 @@ bayesAB(distribution_name, higher_is_better, variant_names, x, y)
**Returned values**
For each variant the function calculates:
- `beats_control` - long-term probability to out-perform the first (control) variant
- `to_be_best` - long-term probability to out-perform all other variants
- `beats_control` long-term probability to out-perform the first (control) variant
- `to_be_best` long-term probability to out-perform all other variants
Type: JSON.
@ -94,4 +94,3 @@ Result:
}
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/machine-learning-functions/) <!--hide-->

View File

@ -54,7 +54,7 @@ If x is non-negative, then `erf(x / σ√2)` is the probability that a ran
Example (three sigma rule):
``` sql
SELECT erf(3 / sqrt(2))
SELECT erf(3 / sqrt(2));
```
``` text
@ -477,4 +477,3 @@ Result:
└──────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/math_functions/) <!--hide-->

View File

@ -1762,7 +1762,6 @@ Result:
```
## randomStringUTF8 {#randomstringutf8}
Generates a random string of a specified length. Result string contains valid UTF-8 code points. The value of code points may be outside of the range of assigned Unicode.
@ -1971,4 +1970,3 @@ Result:
- [tcp_port](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-tcp_port)
[Original article](https://clickhouse.tech/docs/en/query_language/functions/other_functions/) <!--hide-->

View File

@ -102,4 +102,3 @@ FROM numbers(3)
│ aeca2A │
└───────────────────────────────────────┘
[Original article](https://clickhouse.tech/docs/en/query_language/functions/random_functions/) <!--hide-->

View File

@ -35,7 +35,7 @@ The function returns the nearest number of the specified order. In case when giv
round(expression [, decimal_places])
```
**Arguments:**
**Arguments**
- `expression` — A number to be rounded. Can be any [expression](../../sql-reference/syntax.md#syntax-expressions) returning the numeric [data type](../../sql-reference/data-types/index.md#data_types).
- `decimal-places` — An integer value.
@ -185,4 +185,3 @@ Accepts a number. If the number is less than 18, it returns 0. Otherwise, it rou
Accepts a number and rounds it down to an element in the specified array. If the value is less than the lowest bound, the lowest bound is returned.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/rounding_functions/) <!--hide-->

View File

@ -150,4 +150,3 @@ Result:
└───────────────────────────────────────────────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/splitting_merging_functions/) <!--hide-->

View File

@ -73,19 +73,19 @@ Returns 1, if the set of bytes is valid UTF-8 encoded, otherwise 0.
Replaces invalid UTF-8 characters by the `<60>` (U+FFFD) character. All running in a row invalid characters are collapsed into the one replacement character.
``` sql
toValidUTF8( input_string )
toValidUTF8(input_string)
```
**Arguments**
- input_string — Any set of bytes represented as the [String](../../sql-reference/data-types/string.md) data type object.
- `input_string` — Any set of bytes represented as the [String](../../sql-reference/data-types/string.md) data type object.
Returned value: Valid UTF-8 string.
**Example**
``` sql
SELECT toValidUTF8('\x61\xF0\x80\x80\x80b')
SELECT toValidUTF8('\x61\xF0\x80\x80\x80b');
```
``` text
@ -122,7 +122,7 @@ Type: `String`.
Query:
``` sql
SELECT repeat('abc', 10)
SELECT repeat('abc', 10);
```
Result:
@ -190,7 +190,7 @@ If any of argument values is `NULL`, `concat` returns `NULL`.
Query:
``` sql
SELECT concat('Hello, ', 'World!')
SELECT concat('Hello, ', 'World!');
```
Result:
@ -245,7 +245,7 @@ SELECT * from key_val;
Query:
``` sql
SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2)
SELECT concat(key1, key2), sum(value) FROM key_val GROUP BY concatAssumeInjective(key1, key2);
```
Result:
@ -336,8 +336,8 @@ trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string)
**Arguments**
- `trim_character`specified characters for trim. [String](../../sql-reference/data-types/string.md).
- `input_string`string for trim. [String](../../sql-reference/data-types/string.md).
- `trim_character`Specified characters for trim. [String](../../sql-reference/data-types/string.md).
- `input_string`String for trim. [String](../../sql-reference/data-types/string.md).
**Returned value**
@ -350,7 +350,7 @@ Type: `String`.
Query:
``` sql
SELECT trim(BOTH ' ()' FROM '( Hello, world! )')
SELECT trim(BOTH ' ()' FROM '( Hello, world! )');
```
Result:
@ -388,7 +388,7 @@ Type: `String`.
Query:
``` sql
SELECT trimLeft(' Hello, world! ')
SELECT trimLeft(' Hello, world! ');
```
Result:
@ -426,7 +426,7 @@ Type: `String`.
Query:
``` sql
SELECT trimRight(' Hello, world! ')
SELECT trimRight(' Hello, world! ');
```
Result:
@ -464,7 +464,7 @@ Type: `String`.
Query:
``` sql
SELECT trimBoth(' Hello, world! ')
SELECT trimBoth(' Hello, world! ');
```
Result:
@ -498,6 +498,7 @@ The result type is UInt64.
Replaces literals, sequences of literals and complex aliases with placeholders.
**Syntax**
``` sql
normalizeQuery(x)
```
@ -617,7 +618,7 @@ This function also replaces numeric character references with Unicode characters
decodeXMLComponent(x)
```
**Parameters**
**Arguments**
- `x` — A sequence of characters. [String](../../sql-reference/data-types/string.md).
@ -648,4 +649,3 @@ Result:
- [List of XML and HTML character entity references](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references)
[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_functions/) <!--hide-->

View File

@ -92,4 +92,3 @@ Predefined characters: `\0`, `\\`, `|`, `(`, `)`, `^`, `$`, `.`, `[`, `]`, `?`,
This implementation slightly differs from re2::RE2::QuoteMeta. It escapes zero byte as `\0` instead of `\x00` and it escapes only required characters.
For more information, see the link: [RE2](https://github.com/google/re2/blob/master/re2/re2.cc#L473)
[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_replace_functions/) <!--hide-->

View File

@ -26,9 +26,9 @@ Alias: `locate(haystack, needle[, start_pos])`.
**Arguments**
- `haystack`string, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
- `haystack`String, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md).
**Returned values**
@ -44,7 +44,7 @@ The phrase “Hello, world!” contains a set of bytes representing a single-byt
Query:
``` sql
SELECT position('Hello, world!', '!')
SELECT position('Hello, world!', '!');
```
Result:
@ -72,7 +72,7 @@ The same phrase in Russian contains characters which cant be represented usin
Query:
``` sql
SELECT position('Привет, мир!', '!')
SELECT position('Привет, мир!', '!');
```
Result:
@ -97,9 +97,9 @@ positionCaseInsensitive(haystack, needle[, start_pos])
**Arguments**
- `haystack`string, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
- `haystack`String, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md).
**Returned values**
@ -113,7 +113,7 @@ Type: `Integer`.
Query:
``` sql
SELECT positionCaseInsensitive('Hello, world!', 'hello')
SELECT positionCaseInsensitive('Hello, world!', 'hello');
```
Result:
@ -140,9 +140,9 @@ positionUTF8(haystack, needle[, start_pos])
**Arguments**
- `haystack`string, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
- `haystack`String, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
**Returned values**
@ -158,7 +158,7 @@ The phrase “Hello, world!” in Russian contains a set of Unicode points repre
Query:
``` sql
SELECT positionUTF8('Привет, мир!', '!')
SELECT positionUTF8('Привет, мир!', '!');
```
Result:
@ -174,7 +174,7 @@ The phrase “Salut, étudiante!”, where character `é` can be represented usi
Query for the letter `é`, which is represented one Unicode point `U+00E9`:
``` sql
SELECT positionUTF8('Salut, étudiante!', '!')
SELECT positionUTF8('Salut, étudiante!', '!');
```
Result:
@ -188,7 +188,7 @@ Result:
Query for the letter `é`, which is represented two Unicode points `U+0065U+0301`:
``` sql
SELECT positionUTF8('Salut, étudiante!', '!')
SELECT positionUTF8('Salut, étudiante!', '!');
```
Result:
@ -213,9 +213,9 @@ positionCaseInsensitiveUTF8(haystack, needle[, start_pos])
**Arguments**
- `haystack`string, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
- `haystack`String, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Optional parameter, position of the first character in the string to start search. [UInt](../../sql-reference/data-types/int-uint.md)
**Returned value**
@ -229,7 +229,7 @@ Type: `Integer`.
Query:
``` sql
SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир')
SELECT positionCaseInsensitiveUTF8('Привет, мир!', 'Мир');
```
Result:
@ -258,8 +258,8 @@ multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen])
**Arguments**
- `haystack`string, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `haystack`String, in which substring will to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle`Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
**Returned values**
@ -270,7 +270,7 @@ multiSearchAllPositions(haystack, [needle1, needle2, ..., needlen])
Query:
``` sql
SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world'])
SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']);
```
Result:
@ -387,7 +387,7 @@ If `haystack` doesnt match the `pattern` regex, an array of empty arrays is r
Query:
``` sql
SELECT extractAllGroupsHorizontal('abc=111, def=222, ghi=333', '("[^"]+"|\\w+)=("[^"]+"|\\w+)')
SELECT extractAllGroupsHorizontal('abc=111, def=222, ghi=333', '("[^"]+"|\\w+)=("[^"]+"|\\w+)');
```
Result:
@ -428,7 +428,7 @@ If `haystack` doesnt match the `pattern` regex, an empty array is returned.
Query:
``` sql
SELECT extractAllGroupsVertical('abc=111, def=222, ghi=333', '("[^"]+"|\\w+)=("[^"]+"|\\w+)')
SELECT extractAllGroupsVertical('abc=111, def=222, ghi=333', '("[^"]+"|\\w+)=("[^"]+"|\\w+)');
```
Result:
@ -506,7 +506,7 @@ Input table:
Query:
``` sql
SELECT * FROM Months WHERE ilike(name, '%j%')
SELECT * FROM Months WHERE ilike(name, '%j%');
```
Result:
@ -618,7 +618,7 @@ countSubstringsCaseInsensitive(haystack, needle[, start_pos])
- `haystack` — The string to search in. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — The substring to search for. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Position of the first character in the string to start search. Optional. [UInt](../../sql-reference/data-types/int-uint.md).
- `start_pos` Position of the first character in the string to start search. Optional. [UInt](../../sql-reference/data-types/int-uint.md).
**Returned values**
@ -631,7 +631,7 @@ Type: [UInt64](../../sql-reference/data-types/int-uint.md).
Query:
``` sql
select countSubstringsCaseInsensitive('aba', 'B');
SELECT countSubstringsCaseInsensitive('aba', 'B');
```
Result:
@ -684,7 +684,7 @@ SELECT countSubstringsCaseInsensitiveUTF8(haystack, needle[, start_pos])
- `haystack` — The string to search in. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — The substring to search for. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `start_pos` Position of the first character in the string to start search. Optional. [UInt](../../sql-reference/data-types/int-uint.md).
- `start_pos` Position of the first character in the string to start search. Optional. [UInt](../../sql-reference/data-types/int-uint.md).
**Returned values**
@ -773,4 +773,3 @@ Result:
└───────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/string_search_functions/) <!--hide-->

View File

@ -47,7 +47,7 @@ You can use the `EXCEPT` expression to skip columns as a result of the query.
**Arguments**
- `x` - A `tuple` function, column, or tuple of elements. [Tuple](../../sql-reference/data-types/tuple.md).
- `x` A `tuple` function, column, or tuple of elements. [Tuple](../../sql-reference/data-types/tuple.md).
**Returned value**

View File

@ -66,7 +66,6 @@ Result:
- [Map(key, value)](../../sql-reference/data-types/map.md) data type
## mapAdd {#function-mapadd}
Collect all the keys and sum corresponding values.

View File

@ -381,7 +381,7 @@ This function accepts 16 bytes string, and returns UUID containing bytes represe
reinterpretAsUUID(fixed_string)
```
**Parameters**
**Arguments**
- `fixed_string` — Big-endian byte string. [FixedString](../../sql-reference/data-types/fixedstring.md#fixedstring).
@ -1210,4 +1210,3 @@ Result:
└───────────────────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/functions/type_conversion_functions/) <!--hide-->

View File

@ -55,7 +55,7 @@ Type: `String`.
**Example**
``` sql
SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk')
SELECT domain('svn+ssh://some.svn-hosting.com:80/repo/trunk');
```
``` text
@ -98,7 +98,7 @@ Type: `String`.
**Example**
``` sql
SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')
SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk');
```
``` text
@ -420,4 +420,3 @@ Removes the query string and fragment identifier. The question mark and number s
Removes the name URL parameter, if present. This function works under the assumption that the parameter name is encoded in the URL exactly the same way as in the passed argument.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/url_functions/) <!--hide-->

View File

@ -165,4 +165,3 @@ SELECT
- [dictGetUUID](../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions-other)
[Original article](https://clickhouse.tech/docs/en/query_language/functions/uuid_function/) <!--hide-->

View File

@ -112,7 +112,7 @@ Finds the highest continent in the hierarchy for the region.
**Syntax**
``` sql
regionToTopContinent(id[, geobase]);
regionToTopContinent(id[, geobase])
```
**Arguments**
@ -150,4 +150,3 @@ Accepts a UInt32 number the region ID from the Yandex geobase. A string with
`ua` and `uk` both mean Ukrainian.
[Original article](https://clickhouse.tech/docs/en/query_language/functions/ym_dict_functions/) <!--hide-->

View File

@ -221,7 +221,7 @@ It also makes sense to specify a local table in the `GLOBAL IN` clause, in case
When max_parallel_replicas is greater than 1, distributed queries are further transformed. For example, the following:
```sql
SEELECT CounterID, count() FROM distributed_table_1 WHERE UserID IN (SELECT UserID FROM local_table_2 WHERE CounterID < 100)
SELECT CounterID, count() FROM distributed_table_1 WHERE UserID IN (SELECT UserID FROM local_table_2 WHERE CounterID < 100)
SETTINGS max_parallel_replicas=3
```

View File

@ -296,4 +296,3 @@ SELECT * FROM t_null WHERE y IS NOT NULL
└───┴───┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/operators/) <!--hide-->

View File

@ -47,4 +47,3 @@ For `ALTER ... ATTACH|DETACH|DROP` queries, you can use the `replication_alter_p
For `ALTER TABLE ... UPDATE|DELETE` queries the synchronicity is defined by the [mutations_sync](../../../operations/settings/settings.md#mutations_sync) setting.
[Original article](https://clickhouse.tech/docs/en/query_language/alter/) <!--hide-->

View File

@ -81,5 +81,5 @@ The `TTL` is no longer there, so the second row is not deleted:
### See Also
- More about the [TTL-expression](../../../../sql-reference/statements/create/table#ttl-expression).
- Modify column [with TTL](../../../../sql-reference/statements/alter/column#alter_modify-column).
- More about the [TTL-expression](../../../sql-reference/statements/create/table.md#ttl-expression).
- Modify column [with TTL](../../../sql-reference/statements/alter/column.md#alter_modify-column).

View File

@ -333,5 +333,3 @@ SELECT * FROM base.t1;
│ 3 │
└───┘
```
[Original article](https://clickhouse.tech/docs/en/sql-reference/statements/create/table) <!--hide-->

View File

@ -473,4 +473,3 @@ Doesnt grant any privileges.
The `ADMIN OPTION` privilege allows a user to grant their role to another user.
[Original article](https://clickhouse.tech/docs/en/query_language/grant/) <!--hide-->

View File

@ -117,4 +117,3 @@ Performance will not decrease if:
- Data is added in real time.
- You upload data that is usually sorted by time.
[Original article](https://clickhouse.tech/docs/en/query_language/insert_into/) <!--hide-->

View File

@ -277,4 +277,3 @@ SYSTEM RESTART REPLICA [db.]replicated_merge_tree_family_table_name
Provides possibility to reinitialize Zookeeper sessions state for all `ReplicatedMergeTree` tables, will compare current state with Zookeeper as source of true and add tasks to Zookeeper queue if needed
[Original article](https://clickhouse.tech/docs/en/query_language/system/) <!--hide-->

View File

@ -102,5 +102,5 @@ WATCH lv EVENTS LIMIT 1
The `FORMAT` clause works the same way as for the [SELECT](../../sql-reference/statements/select/format.md#format-clause).
!!! info "Note"
The [JSONEachRowWithProgress](../../../interfaces/formats/#jsoneachrowwithprogress) format should be used when watching [live view](./create/view.md#live-view) tables over the HTTP interface. The progress messages will be added to the output to keep the long-lived HTTP connection alive until the query result changes. The interval between progress messages is controlled using the [live_view_heartbeat_interval](./create/view.md#live-view-settings) setting.
The [JSONEachRowWithProgress](../../interfaces/formats/#jsoneachrowwithprogress) format should be used when watching [live view](./create/view.md#live-view) tables over the HTTP interface. The progress messages will be added to the output to keep the long-lived HTTP connection alive until the query result changes. The interval between progress messages is controlled using the [live_view_heartbeat_interval](./create/view.md#live-view-settings) setting.

View File

@ -124,6 +124,6 @@ SELECT count(*) FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String,
**See Also**
- [Virtual columns](index.md#table_engines-virtual_columns)
- [Virtual columns](../../engines/table-engines/index.md#table_engines-virtual_columns)
[Original article](https://clickhouse.tech/docs/en/sql-reference/table-functions/file/) <!--hide-->

View File

@ -10,7 +10,7 @@ Allows to populate test tables with data.
Supports all data types that can be stored in table except `LowCardinality` and `AggregateFunction`.
``` sql
generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]]);
generateRandom('name TypeName[, name TypeName]...', [, 'random_seed'[, 'max_string_length'[, 'max_array_length']]])
```
**Arguments**
@ -39,4 +39,3 @@ SELECT * FROM generateRandom('a Array(Int8), d Decimal32(4), c Tuple(DateTime64(
└──────────┴──────────────┴────────────────────────────────────────────────────────────────────┘
```
[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/generate/) <!--hide-->

View File

@ -97,6 +97,5 @@ FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name Strin
**See Also**
- [Virtual columns](https://clickhouse.tech/docs/en/operations/table_engines/#table_engines-virtual_columns)
- [Virtual columns](../../engines/table-engines/index.md#table_engines-virtual_columns)
[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/hdfs/) <!--hide-->

View File

@ -22,16 +22,15 @@ You can use table functions in:
You cant use table functions if the [allow_ddl](../../operations/settings/permissions-for-queries.md#settings_allow_ddl) setting is disabled.
| Function | Description |
|-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [file](../../sql-reference/table-functions/file.md) | Creates a [File](../../engines/table-engines/special/file.md)-engine table. |
| [merge](../../sql-reference/table-functions/merge.md) | Creates a [Merge](../../engines/table-engines/special/merge.md)-engine table. |
|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [file](../../sql-reference/table-functions/file.md) | Creates a File-engine table. |
| [merge](../../sql-reference/table-functions/merge.md) | Creates a Merge-engine table. |
| [numbers](../../sql-reference/table-functions/numbers.md) | Creates a table with a single column filled with integer numbers. |
| [remote](../../sql-reference/table-functions/remote.md) | Allows you to access remote servers without creating a [Distributed](../../engines/table-engines/special/distributed.md)-engine table. |
| [url](../../sql-reference/table-functions/url.md) | Creates a [Url](../../engines/table-engines/special/url.md)-engine table. |
| [mysql](../../sql-reference/table-functions/mysql.md) | Creates a [MySQL](../../engines/table-engines/integrations/mysql.md)-engine table. |
| [jdbc](../../sql-reference/table-functions/jdbc.md) | Creates a [JDBC](../../engines/table-engines/integrations/jdbc.md)-engine table. |
| [odbc](../../sql-reference/table-functions/odbc.md) | Creates a [ODBC](../../engines/table-engines/integrations/odbc.md)-engine table. |
| [hdfs](../../sql-reference/table-functions/hdfs.md) | Creates a [HDFS](../../engines/table-engines/integrations/hdfs.md)-engine table. |
| [s3](../../sql-reference/table-functions/s3.md) | Creates a [S3](../../engines/table-engines/integrations/s3.md)-engine table. |
[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/) <!--hide-->
| [remote](../../sql-reference/table-functions/remote.md) | Allows you to access remote servers without creating a Distributed-engine table. |
| [url](../../sql-reference/table-functions/url.md) | Creates a URL-engine table. |
| [mysql](../../sql-reference/table-functions/mysql.md) | Creates a MySQL-engine table. |
| [postgresql](../../sql-reference/table-functions/postgresql.md) | Creates a PostgreSQL-engine table. |
| [jdbc](../../sql-reference/table-functions/jdbc.md) | Creates a JDBC-engine table. |
| [odbc](../../sql-reference/table-functions/odbc.md) | Creates a ODBC-engine table. |
| [hdfs](../../sql-reference/table-functions/hdfs.md) | Creates a HDFS-engine table. |
| [s3](../../sql-reference/table-functions/s3.md) | Creates a S3-engine table. |

View File

@ -42,4 +42,3 @@ $ cat data.csv | clickhouse-client --query="INSERT INTO test FORMAT CSV"
$ cat data.csv | clickhouse-client --query="INSERT INTO test SELECT * FROM input('test_structure') FORMAT CSV"
```
[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/input/) <!--hide-->

View File

@ -24,4 +24,3 @@ SELECT * FROM jdbc('mysql://localhost:3306/?user=root&password=root', 'schema',
SELECT * FROM jdbc('datasource://mysql-local', 'schema', 'table')
```
[Original article](https://clickhouse.tech/docs/en/query_language/table_functions/jdbc/) <!--hide-->

Some files were not shown because too many files have changed in this diff Show More