Skip to content

Commit 48a2901

Browse files
committed
Merge branch 'master' into fix-s3-zero-copy-test
2 parents 1044d1d + 02e6d1c commit 48a2901

File tree

76 files changed

+987
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+987
-200
lines changed

base/base/defines.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
#define NO_INLINE __attribute__((__noinline__))
2929
#define MAY_ALIAS __attribute__((__may_alias__))
3030

31+
#if defined(__x86_64__) || defined(__aarch64__)
32+
# define PRESERVE_MOST __attribute__((preserve_most))
33+
#else
34+
# define PRESERVE_MOST
35+
#endif
36+
3137
#if !defined(__x86_64__) && !defined(__aarch64__) && !defined(__PPC__) && !defined(__s390x__) && !(defined(__loongarch64)) && !(defined(__riscv) && (__riscv_xlen == 64))
3238
# error "The only supported platforms are x86_64 and AArch64, PowerPC (work in progress), s390x (work in progress), loongarch64 (experimental) and RISC-V 64 (experimental)"
3339
#endif

ci/defs/job_configs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ class JobConfigs:
476476
digest_config=Job.CacheDigestConfig(
477477
include_paths=[
478478
"./tests/queries/0_stateless/",
479+
"./tests/ci/stress.py",
479480
"./tests/clickhouse-test",
480481
"./tests/config",
481482
"./tests/*.txt",

docs/en/engines/table-engines/integrations/s3.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ Received exception from server (version 23.4.1):
174174
Code: 48. DB::Exception: Received from localhost:9000. DB::Exception: Reading from a partitioned S3 storage is not implemented yet. (NOT_IMPLEMENTED)
175175
```
176176

177+
## Inserting Data {#inserting-data}
178+
179+
Note that rows can only be inserted into new files. There are no merge cycles or file split operations. Once a file is written, subsequent inserts will fail. To avoid this you can use `s3_truncate_on_insert` and `s3_create_new_file_on_insert` settings. See more details [here](/integrations/s3#inserting-data).
180+
177181
## Virtual columns {#virtual-columns}
178182

179183
- `_path` — Path to the file. Type: `LowCardinality(String)`.
@@ -340,12 +344,12 @@ FROM s3(
340344
);
341345
```
342346

343-
:::note
347+
:::note
344348
ClickHouse supports three archive formats:
345349
ZIP
346350
TAR
347351
7Z
348-
While ZIP and TAR archives can be accessed from any supported storage location, 7Z archives can only be read from the local filesystem where ClickHouse is installed.
352+
While ZIP and TAR archives can be accessed from any supported storage location, 7Z archives can only be read from the local filesystem where ClickHouse is installed.
349353
:::
350354

351355

@@ -367,3 +371,4 @@ For details on optimizing the performance of the s3 function see [our detailed g
367371
## See also {#see-also}
368372

369373
- [s3 table function](../../../sql-reference/table-functions/s3.md)
374+
- [Integrating S3 with ClickHouse](/integrations/s3)

docs/en/sql-reference/aggregate-functions/reference/estimateCompressionRatio.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ estimateCompressionRatio(codec, block_size_bytes)(column)
2121

2222
**Parameters**
2323

24-
- `codec` - [String](../../../sql-reference/data-types/string.md) containing a [compression codec](/sql-reference/statements/create/table#column-compression-codecs).
24+
- `codec` - [String](../../../sql-reference/data-types/string.md) containing a [compression codec](/sql-reference/statements/create/table#column_compression_codec).
2525
- `block_size_bytes` - Block size of compressed data. This is similar to setting both [`max_compress_block_size`](../../../operations/settings/merge-tree-settings.md#max_compress_block_size) and [`min_compress_block_size`](../../../operations/settings/merge-tree-settings.md#min_compress_block_size). The default value is 1 MiB (1048576 bytes).
2626

2727
Both parameters are optional.
@@ -64,7 +64,7 @@ Result:
6464
```
6565

6666
:::note
67-
The result above will differ based on the default compression codec of the server. See [Column Compression Codecs](/sql-reference/statements/create/table#column-compression-codecs).
67+
The result above will differ based on the default compression codec of the server. See [Column Compression Codecs](/sql-reference/statements/create/table#column_compression_codec).
6868
:::
6969

7070
Query:

docs/en/sql-reference/table-functions/s3.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ LIMIT 5;
254254

255255
## Using S3 credentials (ClickHouse Cloud) {#using-s3-credentials-clickhouse-cloud}
256256

257-
For non-public buckets, users can pass an `aws_access_key_id` and `aws_secret_access_key` to the function. For example:
257+
For non-public buckets, users can pass an `aws_access_key_id` and `aws_secret_access_key` to the function. For example:
258258

259259
```sql
260260
SELECT count() FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.com/mta/*.tsv', '<KEY>', '<SECRET>','TSVWithNames')
@@ -289,20 +289,23 @@ FROM s3(
289289
);
290290
```
291291

292-
:::note
292+
:::note
293293
ClickHouse supports three archive formats:
294294
ZIP
295295
TAR
296296
7Z
297-
While ZIP and TAR archives can be accessed from any supported storage location, 7Z archives can only be read from the local filesystem where ClickHouse is installed.
297+
While ZIP and TAR archives can be accessed from any supported storage location, 7Z archives can only be read from the local filesystem where ClickHouse is installed.
298298
:::
299299

300+
## Inserting Data {#inserting-data}
301+
302+
Note that rows can only be inserted into new files. There are no merge cycles or file split operations. Once a file is written, subsequent inserts will fail. See more details [here](/integrations/s3#inserting-data).
300303

301304
## Virtual Columns {#virtual-columns}
302305

303306
- `_path` — Path to the file. Type: `LowCardinality(String)`. In case of archive, shows path in a format: `"{path_to_archive}::{path_to_file_inside_archive}"`
304307
- `_file` — Name of the file. Type: `LowCardinality(String)`. In case of archive shows name of the file inside the archive.
305-
- `_size` — Size of the file in bytes. Type: `Nullable(UInt64)`. If the file size is unknown, the value is `NULL`. In case of archive shows uncompressed file size of the file inside the archive.
308+
- `_size` — Size of the file in bytes. Type: `Nullable(UInt64)`. If the file size is unknown, the value is `NULL`. In case of archive shows uncompressed file size of the file inside the archive.
306309
- `_time` — Last modified time of the file. Type: `Nullable(DateTime)`. If the time is unknown, the value is `NULL`.
307310

308311
## Hive-style partitioning {#hive-style-partitioning}
@@ -345,3 +348,5 @@ Peak memory usage: 192.27 KiB.
345348
**See Also**
346349

347350
- [S3 engine](../../engines/table-engines/integrations/s3.md)
351+
- [Integrating S3 with ClickHouse](/integrations/s3)
352+

docs/ru/engines/table-engines/integrations/s3.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CREATE TABLE s3_engine_table (name String, value UInt32)
2626
**Пример**
2727

2828
``` sql
29-
CREATE TABLE s3_engine_table (name String, value UInt32)
29+
CREATE TABLE s3_engine_table (name String, value UInt32)
3030
ENGINE=S3('https://storage.yandexcloud.net/my-test-bucket-768/test-data.csv.gz', 'CSV', 'gzip')
3131
SETTINGS input_format_with_names_use_header = 0;
3232

@@ -42,6 +42,26 @@ SELECT * FROM s3_engine_table LIMIT 2;
4242
└──────┴───────┘
4343
```
4444

45+
## Вставка данных {#inserting-data}
46+
47+
Внимание!!! Вставка данных осуществляется только в новые файлы. S3 и его клоны не поддерживают APPEND.
48+
Если файл существует, любая следующая операция вставки будет неуспешной.
49+
Тем не менее существует два способа изменить это настройками перед выполнением запроса или в конфигурационном файле:
50+
51+
- s3_truncate_on_insert - включает очистку файла перед записью.
52+
53+
Значения:
54+
55+
- 0 — `INSERT` создаёт новый файл или падает, если файл уже есть и настройка s3_create_new_file_on_insert = 0.
56+
- 1 — `INSERT` пересоздаёт файл, вне зависимости от настройки s3_create_new_file_on_insert.
57+
58+
- s3_create_new_file_on_insert - вставляет данные в новый файл с суффиксом в имени, если основной файл уже есть.
59+
60+
Значения:
61+
62+
- 0 — `INSERT` создаёт новый файл или падает, если файл уже есть и настройка s3_truncate_on_insert = 0.
63+
- 1 — `INSERT` вставляет данные в новый файл с суффиксом в имени, если настройка s3_truncate_on_insert = 0.
64+
4565
## Виртуальные столбцы {#virtual-columns}
4666

4767
- `_path` — путь к файлу.
@@ -93,7 +113,7 @@ CREATE TABLE big_table (name String, value UInt32)
93113

94114
Существует несколько способов создать таблицу, включающую в себя все шесть файлов:
95115

96-
1. Задайте диапазон для суффиксов в названии файла:
116+
1. Задайте диапазон для суффиксов в названии файла:
97117

98118
``` sql
99119
CREATE TABLE table_with_range (name String, value UInt32)

docs/ru/sql-reference/table-functions/s3.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ s3(path [,access_key_id, secret_access_key [,session_token]] [,format] [,structu
2525

2626
Таблица с указанной структурой для чтения или записи данных в указанный файл.
2727

28+
**Вставка данных**
29+
30+
Внимание!!! Вставка данных осуществляется только в новые файлы. S3 и его клоны не поддерживают APPEND. Как только файл существует,
31+
любая следующая операция вставки будет неуспешной.
32+
Тем не менее существует два способа изменить это настройками перед выполнением запроса или в конфигурационном файле:
33+
34+
- s3_truncate_on_insert
35+
- s3_create_new_file_on_insert
36+
37+
См. подробнее [тут](../../engines/table-engines/integrations/s3.md#inserting-data).
38+
2839
**Примеры**
2940

3041
Создание таблицы из файла S3 `https://storage.yandexcloud.net/my-test-bucket-768/data.csv` и выбор первых трех столбцов из нее:
@@ -65,6 +76,28 @@ LIMIT 2;
6576
└─────────┴─────────┴─────────┘
6677
```
6778

79+
Создание файла S3 `https://storage.yandexcloud.net/my-test-bucket-777/data.csv` в помощью INSERT:
80+
81+
``` sql
82+
INSERT INTO FUNCTION s3('https://storage.yandexcloud.net/my-test-bucket-777/data.csv', 'CSV', 'name String, value UInt32') VALUES ('one', 1), ('two', 2), ('three', 3);
83+
```
84+
85+
``` sql
86+
SELECT *
87+
FROM s3('https://storage.yandexcloud.net/my-test-bucket-777/data.csv', 'CSV', 'name String, value UInt32')
88+
LIMIT 2;
89+
```
90+
91+
Результат:
92+
93+
``` text
94+
┌─name──┬─value─┐
95+
│ one │ 1 │
96+
│ two │ 2 │
97+
│ three │ 3 │
98+
└───────┴───────┘
99+
```
100+
68101
## Примеры использования {#usage-examples}
69102

70103
Предположим, у нас есть несколько файлов со следующими URI на S3:

programs/keeper/Keeper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ try
365365
std::filesystem::create_directories(path);
366366

367367
/// Check that the process user id matches the owner of the data.
368-
assertProcessUserMatchesDataOwner(path, [&](const std::string & message){ LOG_WARNING(log, fmt::runtime(message)); });
368+
assertProcessUserMatchesDataOwner(path, [&](const PreformattedMessage & message){ LOG_WARNING(log, fmt::runtime(message.text)); });
369369

370370
DB::ServerUUID::load(path + "/uuid", log);
371371

0 commit comments

Comments
 (0)