mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge remote-tracking branch 'upstream/master' into ncb/complete-h3-inspection-funcs
This commit is contained in:
commit
de65461158
@ -3604,6 +3604,18 @@ Possible values:
|
||||
|
||||
Default value: `1000`.
|
||||
|
||||
## log_queries_probability {#log-queries-probability}
|
||||
|
||||
Allows a user to write to [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md), and [query_views_log](../../operations/system-tables/query_views_log.md) system tables only a sample of queries selected randomly with the specified probability. It helps to reduce the load with a large volume of queries in a second.
|
||||
|
||||
Possible values:
|
||||
|
||||
- 0 — Queries are not logged in the system tables.
|
||||
- Positive floating-point number in the range [0..1]. For example, if the setting value is `0.5`, about half of the queries are logged in the system tables.
|
||||
- 1 — All queries are logged in the system tables.
|
||||
|
||||
Default value: `1`.
|
||||
|
||||
## short_circuit_function_evaluation {#short-circuit-function-evaluation}
|
||||
|
||||
Allows calculating the [if](../../sql-reference/functions/conditional-functions.md#if), [multiIf](../../sql-reference/functions/conditional-functions.md#multiif), [and](../../sql-reference/functions/logical-functions.md#logical-and-function), and [or](../../sql-reference/functions/logical-functions.md#logical-or-function) functions according to a [short scheme](https://en.wikipedia.org/wiki/Short-circuit_evaluation). This helps optimize the execution of complex expressions in these functions and prevent possible exceptions (such as division by zero when it is not expected).
|
||||
|
@ -24,6 +24,8 @@ Each query creates one or two rows in the `query_log` table, depending on the st
|
||||
2. If an error occurred during query processing, two events with the `QueryStart` and `ExceptionWhileProcessing` types are created.
|
||||
3. If an error occurred before launching the query, a single event with the `ExceptionBeforeStart` type is created.
|
||||
|
||||
You can use the [log_queries_probability](../../operations/settings/settings.md#log-queries-probability) setting to reduce the number of queries, registered in the `query_log` table.
|
||||
|
||||
Columns:
|
||||
|
||||
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — Type of an event that occurred when executing the query. Values:
|
||||
|
@ -11,6 +11,8 @@ The flushing period of data is set in `flush_interval_milliseconds` parameter of
|
||||
|
||||
ClickHouse does not delete data from the table automatically. See [Introduction](../../operations/system-tables/index.md#system-tables-introduction) for more details.
|
||||
|
||||
You can use the [log_queries_probability](../../operations/settings/settings.md#log-queries-probability) setting to reduce the number of queries, registered in the `query_thread_log` table.
|
||||
|
||||
Columns:
|
||||
|
||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the thread has finished execution of the query.
|
||||
|
@ -11,6 +11,8 @@ The flushing period of data is set in `flush_interval_milliseconds` parameter of
|
||||
|
||||
ClickHouse does not delete data from the table automatically. See [Introduction](../../operations/system-tables/index.md#system-tables-introduction) for more details.
|
||||
|
||||
You can use the [log_queries_probability](../../operations/settings/settings.md#log-queries-probability) setting to reduce the number of queries, registered in the `query_views_log` table.
|
||||
|
||||
Columns:
|
||||
|
||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — The date when the last event of the view happened.
|
||||
@ -43,10 +45,14 @@ Columns:
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
``` sql
|
||||
SELECT * FROM system.query_views_log LIMIT 1 \G
|
||||
SELECT * FROM system.query_views_log LIMIT 1 \G;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
``` text
|
||||
Row 1:
|
||||
──────
|
||||
@ -77,5 +83,4 @@ stack_trace:
|
||||
- [system.query_log](../../operations/system-tables/query_log.md#system_tables-query_log) — Description of the `query_log` system table which contains common information about queries execution.
|
||||
- [system.query_thread_log](../../operations/system-tables/query_thread_log.md#system_tables-query_thread_log) — This table contains information about each query execution thread.
|
||||
|
||||
|
||||
[Original article](https://clickhouse.com/docs/en/operations/system_tables/query_thread_log) <!--hide-->
|
||||
|
@ -3396,6 +3396,18 @@ SETTINGS index_granularity = 8192 │
|
||||
|
||||
Значение по умолчанию: `1000`.
|
||||
|
||||
## log_queries_probability {#log-queries-probability}
|
||||
|
||||
Позволяет пользователю записывать в системные таблицы [query_log](../../operations/system-tables/query_log.md), [query_thread_log](../../operations/system-tables/query_thread_log.md) и [query_views_log](../../operations/system-tables/query_views_log.md) только часть запросов, выбранных случайным образом, с указанной вероятностью. Это помогает снизить нагрузку при большом объеме запросов в секунду.
|
||||
|
||||
Возможные значения:
|
||||
|
||||
- 0 — запросы не регистрируются в системных таблицах.
|
||||
- Положительное число с плавающей точкой в диапазоне [0..1]. Например, при значении настройки, равном `0.5`, примерно половина запросов регистрируется в системных таблицах.
|
||||
- 1 — все запросы регистрируются в системных таблицах.
|
||||
|
||||
Значение по умолчанию: `1`.
|
||||
|
||||
## short_circuit_function_evaluation {#short-circuit-function-evaluation}
|
||||
|
||||
Позволяет вычислять функции [if](../../sql-reference/functions/conditional-functions.md#if), [multiIf](../../sql-reference/functions/conditional-functions.md#multiif), [and](../../sql-reference/functions/logical-functions.md#logical-and-function) и [or](../../sql-reference/functions/logical-functions.md#logical-or-function) по [короткой схеме](https://ru-wikipedia-org.turbopages.org/ru.wikipedia.org/s/wiki/Вычисления_по_короткой_схеме). Это помогает оптимизировать выполнение сложных выражений в этих функциях и предотвратить возможные исключения (например, деление на ноль, когда оно не ожидается).
|
||||
@ -3433,7 +3445,6 @@ SELECT multiMatchAny('abcd', ['ab','bcd','c','d']) SETTINGS max_hyperscan_regexp
|
||||
┌─multiMatchAny('abcd', ['ab', 'bcd', 'c', 'd'])─┐
|
||||
│ 1 │
|
||||
└────────────────────────────────────────────────┘
|
||||
|
||||
```
|
||||
|
||||
Запрос:
|
||||
@ -3452,7 +3463,6 @@ Exception: Regexp length too large.
|
||||
|
||||
- [max_hyperscan_regexp_total_length](#max-hyperscan-regexp-total-length)
|
||||
|
||||
|
||||
## max_hyperscan_regexp_total_length {#max-hyperscan-regexp-total-length}
|
||||
|
||||
Задает максимальную общую длину всех регулярных выражений в каждой [hyperscan-функции](../../sql-reference/functions/string-search-functions.md#multimatchanyhaystack-pattern1-pattern2-patternn) поиска множественных совпадений в строке.
|
||||
|
@ -24,6 +24,8 @@ ClickHouse не удаляет данные из таблица автомати
|
||||
2. Если во время обработки запроса возникла ошибка, создаются два события с типами `QueryStart` и `ExceptionWhileProcessing`.
|
||||
3. Если ошибка произошла ещё до запуска запроса, создается одно событие с типом `ExceptionBeforeStart`.
|
||||
|
||||
Чтобы уменьшить количество запросов, регистрирующихся в таблице `query_log`, вы можете использовать настройку [log_queries_probability](../../operations/settings/settings.md#log-queries-probability).
|
||||
|
||||
Столбцы:
|
||||
|
||||
- `type` ([Enum8](../../sql-reference/data-types/enum.md)) — тип события, произошедшего при выполнении запроса. Значения:
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
ClickHouse не удаляет данные из таблицы автоматически. Подробности в разделе [Введение](#system-tables-introduction).
|
||||
|
||||
Чтобы уменьшить количество запросов, регистрирующихся в таблице `query_thread_log`, вы можете использовать настройку [log_queries_probability](../../operations/settings/settings.md#log-queries-probability).
|
||||
|
||||
Столбцы:
|
||||
|
||||
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — дата завершения выполнения запроса потоком.
|
||||
|
@ -93,7 +93,7 @@ def build_for_lang(lang, args):
|
||||
site_url=f'{website_url}/docs/{lang}/',
|
||||
docs_dir=os.path.join(args.docs_dir, lang),
|
||||
site_dir=site_dir,
|
||||
strict=False, # TODO: fix issues and return True
|
||||
strict=True,
|
||||
theme=theme_cfg,
|
||||
copyright='©2016–2021 ClickHouse, Inc.',
|
||||
use_directory_urls=True,
|
||||
|
@ -280,7 +280,7 @@ protected:
|
||||
|
||||
auto credentials_view = credentials_doc.View();
|
||||
access_key = credentials_view.GetString("AccessKeyId");
|
||||
LOG_ERROR(logger, "Successfully pulled credentials from EC2MetadataService with access key {}.", access_key);
|
||||
LOG_TRACE(logger, "Successfully pulled credentials from EC2MetadataService with access key {}.", access_key);
|
||||
|
||||
secret_key = credentials_view.GetString("SecretAccessKey");
|
||||
token = credentials_view.GetString("Token");
|
||||
|
@ -1525,6 +1525,26 @@ bool ParserNull::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
}
|
||||
|
||||
|
||||
static bool parseNumber(char * buffer, size_t size, bool negative, int base, Field & res)
|
||||
{
|
||||
errno = 0; /// Functions strto* don't clear errno.
|
||||
|
||||
char * pos_integer = buffer;
|
||||
UInt64 uint_value = std::strtoull(buffer, &pos_integer, base);
|
||||
|
||||
if (pos_integer == buffer + size && errno != ERANGE && (!negative || uint_value <= (1ULL << 63)))
|
||||
{
|
||||
if (negative)
|
||||
res = static_cast<Int64>(-uint_value);
|
||||
else
|
||||
res = uint_value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ParserNumber::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
Pos literal_begin = pos;
|
||||
@ -1564,6 +1584,22 @@ bool ParserNumber::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
Float64 float_value = std::strtod(buf, &pos_double);
|
||||
if (pos_double != buf + pos->size() || errno == ERANGE)
|
||||
{
|
||||
/// Try to parse number as binary literal representation. Example: 0b0001.
|
||||
if (pos->size() > 2 && buf[0] == '0' && buf[1] == 'b')
|
||||
{
|
||||
char * buf_skip_prefix = buf + 2;
|
||||
|
||||
if (parseNumber(buf_skip_prefix, pos->size() - 2, negative, 2, res))
|
||||
{
|
||||
auto literal = std::make_shared<ASTLiteral>(res);
|
||||
literal->begin = literal_begin;
|
||||
literal->end = ++pos;
|
||||
node = literal;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
expected.add(pos, "number");
|
||||
return false;
|
||||
}
|
||||
@ -1578,22 +1614,16 @@ bool ParserNumber::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
|
||||
/// try to use more exact type: UInt64
|
||||
|
||||
char * pos_integer = buf;
|
||||
|
||||
errno = 0;
|
||||
UInt64 uint_value = std::strtoull(buf, &pos_integer, 0);
|
||||
if (pos_integer == pos_double && errno != ERANGE && (!negative || uint_value <= (1ULL << 63)))
|
||||
if (parseNumber(buf, pos->size(), negative, 0, res))
|
||||
{
|
||||
if (negative)
|
||||
res = static_cast<Int64>(-uint_value);
|
||||
else
|
||||
res = uint_value;
|
||||
auto literal = std::make_shared<ASTLiteral>(res);
|
||||
literal->begin = literal_begin;
|
||||
literal->end = ++pos;
|
||||
node = literal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto literal = std::make_shared<ASTLiteral>(res);
|
||||
literal->begin = literal_begin;
|
||||
literal->end = ++pos;
|
||||
node = literal;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
1 UInt8
|
||||
2 UInt8
|
||||
4 UInt8
|
||||
8 UInt8
|
||||
Unsigned numbers
|
||||
128 UInt8
|
||||
32768 UInt16
|
||||
2147483648 UInt32
|
||||
9223372036854775808 UInt64
|
||||
Signed numbers
|
||||
-128 Int8
|
||||
-32768 Int16
|
||||
-2147483648 Int32
|
||||
-9223372036854775808 Int64
|
@ -0,0 +1,16 @@
|
||||
SELECT 0b0001 as number, toTypeName(number);
|
||||
SELECT 0b0010 as number, toTypeName(number);
|
||||
SELECT 0b0100 as number, toTypeName(number);
|
||||
SELECT 0b1000 as number, toTypeName(number);
|
||||
|
||||
SELECT 'Unsigned numbers';
|
||||
SELECT 0b10000000 as number, toTypeName(number);
|
||||
SELECT 0b1000000000000000 as number, toTypeName(number);
|
||||
SELECT 0b10000000000000000000000000000000 as number, toTypeName(number);
|
||||
SELECT 0b1000000000000000000000000000000000000000000000000000000000000000 as number, toTypeName(number);
|
||||
|
||||
SELECT 'Signed numbers';
|
||||
SELECT -0b10000000 as number, toTypeName(number);
|
||||
SELECT -0b1000000000000000 as number, toTypeName(number);
|
||||
SELECT -0b10000000000000000000000000000000 as number, toTypeName(number);
|
||||
SELECT -0b1000000000000000000000000000000000000000000000000000000000000000 as number, toTypeName(number);
|
Loading…
Reference in New Issue
Block a user