Merge remote-tracking branch 'ClickHouse/master' into 66010-add-machine-id-to-snowflakeid-clean

This commit is contained in:
Robert Schulze 2024-07-15 15:01:43 +00:00
commit 07ea0f59b3
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
493 changed files with 2553 additions and 677 deletions

View File

@ -13,3 +13,6 @@
# dbms/ → src/ # dbms/ → src/
# (though it is unlikely that you will see it in blame) # (though it is unlikely that you will see it in blame)
06446b4f08a142d6f1bc30664c47ded88ab51782 06446b4f08a142d6f1bc30664c47ded88ab51782
# Applied Black formatter for Python code
e6f5a3f98b21ba99cf274a9833797889e020a2b3

View File

@ -102,6 +102,8 @@ jobs:
--job-name '${{inputs.test_name}}' \ --job-name '${{inputs.test_name}}' \
--run \ --run \
--run-command '''${{inputs.run_command}}''' --run-command '''${{inputs.run_command}}'''
# shellcheck disable=SC2319
echo "JOB_EXIT_CODE=$?" >> "$GITHUB_ENV"
- name: Post run - name: Post run
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
run: | run: |

View File

@ -34,11 +34,7 @@ if (OS_LINUX)
# avoid spurious latencies and additional work associated with # avoid spurious latencies and additional work associated with
# MADV_DONTNEED. See # MADV_DONTNEED. See
# https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation. # https://github.com/ClickHouse/ClickHouse/issues/11121 for motivation.
if (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
else()
set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000,prof:true,prof_active:false,background_thread:true") set (JEMALLOC_CONFIG_MALLOC_CONF "percpu_arena:percpu,oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000,prof:true,prof_active:false,background_thread:true")
endif()
else() else()
set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000") set (JEMALLOC_CONFIG_MALLOC_CONF "oversize_threshold:0,muzzy_decay_ms:0,dirty_decay_ms:5000")
endif() endif()

View File

@ -4,3 +4,14 @@ It allows to integrate JEMalloc into CMake project.
- Added JEMALLOC_CONFIG_MALLOC_CONF substitution - Added JEMALLOC_CONFIG_MALLOC_CONF substitution
- Add musl support (USE_MUSL) - Add musl support (USE_MUSL)
- Also note, that darwin build requires JEMALLOC_PREFIX, while others do not - Also note, that darwin build requires JEMALLOC_PREFIX, while others do not
- JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE should be disabled
CLOCK_MONOTONIC_COARSE can go backwards after clock_adjtime(ADJ_FREQUENCY)
Let's disable it for now, and this menas that CLOCK_MONOTONIC will be used,
and this, should not be a problem, since:
- jemalloc do not call clock_gettime() that frequently
- the difference is CLOCK_MONOTONIC 20ns and CLOCK_MONOTONIC_COARSE 4ns
This can be done with the following command:
gg JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE | cut -d: -f1 | xargs sed -i 's@#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE@/* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */@'

View File

@ -96,7 +96,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -98,7 +98,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -98,7 +98,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -98,7 +98,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -96,7 +96,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -98,7 +98,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

View File

@ -99,7 +99,7 @@
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
*/ */
#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE /* #undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE */
/* /*
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available. * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.

2
contrib/openssl vendored

@ -1 +1 @@
Subproject commit ee2bb8513b28bf86b35404dd17a0e29305ca9e08 Subproject commit 66deddc1e53cda8706604a019777259372d1bd62

View File

@ -25,7 +25,7 @@ source /utils.lib
azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --silent --inMemoryPersistence & azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --silent --inMemoryPersistence &
./setup_minio.sh stateful ./setup_minio.sh stateful
./mc admin trace clickminio > /test_output/rubbish.log & ./mc admin trace clickminio > /test_output/minio.log &
MC_ADMIN_PID=$! MC_ADMIN_PID=$!
config_logs_export_cluster /etc/clickhouse-server/config.d/system_logs_export.yaml config_logs_export_cluster /etc/clickhouse-server/config.d/system_logs_export.yaml

View File

@ -54,7 +54,7 @@ source /utils.lib
/usr/share/clickhouse-test/config/install.sh /usr/share/clickhouse-test/config/install.sh
./setup_minio.sh stateless ./setup_minio.sh stateless
m./c admin trace clickminio > /test_output/rubbish.log & ./mc admin trace clickminio > /test_output/minio.log &
MC_ADMIN_PID=$! MC_ADMIN_PID=$!
./setup_hdfs_minicluster.sh ./setup_hdfs_minicluster.sh

View File

@ -10,7 +10,7 @@ cd hadoop-3.3.1
export JAVA_HOME=/usr export JAVA_HOME=/usr
mkdir -p target/test/data mkdir -p target/test/data
chown clickhouse ./target/test/data chown clickhouse ./target/test/data
sudo -E -u clickhouse bin/mapred minicluster -format -nomr -nnport 12222 >> /test_output/garbage.log 2>&1 & sudo -E -u clickhouse bin/mapred minicluster -format -nomr -nnport 12222 >> /test_output/hdfs_minicluster.log 2>&1 &
while ! nc -z localhost 12222; do while ! nc -z localhost 12222; do
sleep 1 sleep 1

View File

@ -226,15 +226,59 @@ Other IDEs you can use are [Sublime Text](https://www.sublimetext.com/), [Visual
## Writing Code {#writing-code} ## Writing Code {#writing-code}
The description of ClickHouse architecture can be found here: https://clickhouse.com/docs/en/development/architecture/ Below you can find some quick links which may be useful when writing code for ClickHouse:
The Code Style Guide: https://clickhouse.com/docs/en/development/style/ - [ClickHouse architecture description](https://clickhouse.com/docs/en/development/architecture/).
- [The code style guide](https://clickhouse.com/docs/en/development/style/).
- [Adding third-party libraries](https://clickhouse.com/docs/en/development/contrib/#adding-third-party-libraries)
- [Writing tests](https://clickhouse.com/docs/en/development/tests/)
- [List of open issues](https://github.com/ClickHouse/ClickHouse/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest)
Adding third-party libraries: https://clickhouse.com/docs/en/development/contrib/#adding-third-party-libraries ## Writing Documentation {#writing-documentation}
Writing tests: https://clickhouse.com/docs/en/development/tests/ As part of every pull request which adds a new feature, it is necessary to write documentation for it. If you'd like to preview your documentation changes the instructions for how to build the documentation page locally are available in the README.md file [here](https://github.com/ClickHouse/clickhouse-docs). When adding a new function to ClickHouse you can use the template below as a guide:
List of tasks: https://github.com/ClickHouse/ClickHouse/issues?q=is%3Aopen+is%3Aissue+label%3Ahacktoberfest ```markdown
# newFunctionName
A short description of the function goes here. It should describe briefly what it does and a typical usage case.
**Syntax**
\```sql
newFunctionName(arg1, arg2[, arg3])
\```
**Arguments**
- `arg1` — Description of the argument. [DataType](../data-types/float.md)
- `arg2` — Description of the argument. [DataType](../data-types/float.md)
- `arg3` — Description of optional argument (optional). [DataType](../data-types/float.md)
**Implementation Details**
A description of implementation details if relevant.
**Returned value**
- Returns {insert what the function returns here}. [DataType](../data-types/float.md)
**Example**
Query:
\```sql
SELECT 'write your example query here';
\```
Response:
\```response
┌───────────────────────────────────┐
│ the result of the query │
└───────────────────────────────────┘
\```
```
## Test Data {#test-data} ## Test Data {#test-data}

View File

@ -15,7 +15,7 @@ You have four options for getting up and running with ClickHouse:
- **[ClickHouse Cloud](https://clickhouse.com/cloud/):** The official ClickHouse as a service, - built by, maintained and supported by the creators of ClickHouse - **[ClickHouse Cloud](https://clickhouse.com/cloud/):** The official ClickHouse as a service, - built by, maintained and supported by the creators of ClickHouse
- **[Quick Install](#quick-install):** an easy-to-download binary for testing and developing with ClickHouse - **[Quick Install](#quick-install):** an easy-to-download binary for testing and developing with ClickHouse
- **[Production Deployments](#available-installation-options):** ClickHouse can run on any Linux, FreeBSD, or macOS with x86-64, ARM, or PowerPC64LE CPU architecture - **[Production Deployments](#available-installation-options):** ClickHouse can run on any Linux, FreeBSD, or macOS with x86-64, modern ARM (ARMv8.2-A up), or PowerPC64LE CPU architecture
- **[Docker Image](https://hub.docker.com/r/clickhouse/clickhouse-server/):** use the official Docker image in Docker Hub - **[Docker Image](https://hub.docker.com/r/clickhouse/clickhouse-server/):** use the official Docker image in Docker Hub
## ClickHouse Cloud ## ClickHouse Cloud

View File

@ -1030,7 +1030,7 @@ A table with no primary key represents the extreme case of a single equivalence
The fewer and the larger the equivalence classes are, the higher the degree of freedom when re-shuffling rows. The fewer and the larger the equivalence classes are, the higher the degree of freedom when re-shuffling rows.
The heuristics applied to find the best row order within each equivalence class is suggested by D. Lemir, O. Kaser in [Reordering columns for smaller indexes](https://doi.org/10.1016/j.ins.2011.02.002) and based on sorting the rows within each equivalence class by ascending cardinality of the non-primary key columns. The heuristics applied to find the best row order within each equivalence class is suggested by D. Lemire, O. Kaser in [Reordering columns for smaller indexes](https://doi.org/10.1016/j.ins.2011.02.002) and based on sorting the rows within each equivalence class by ascending cardinality of the non-primary key columns.
It performs three steps: It performs three steps:
1. Find all equivalence classes based on the row values in primary key columns. 1. Find all equivalence classes based on the row values in primary key columns.
2. For each equivalence class, calculate (usually estimate) the cardinalities of the non-primary-key columns. 2. For each equivalence class, calculate (usually estimate) the cardinalities of the non-primary-key columns.

View File

@ -2698,6 +2698,204 @@ Like function `YYYYMMDDhhmmssToDate()` but produces a [DateTime64](../data-types
Accepts an additional, optional `precision` parameter after the `timezone` parameter. Accepts an additional, optional `precision` parameter after the `timezone` parameter.
## changeYear
Changes the year component of a date or date time.
**Syntax**
``` sql
changeYear(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the year. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- The same type as `date_or_datetime`.
**Example**
``` sql
SELECT changeYear(toDate('1999-01-01'), 2000), changeYear(toDateTime64('1999-01-01 00:00:00.000', 3), 2000);
```
Result:
```
┌─changeYear(toDate('1999-01-01'), 2000)─┬─changeYear(toDateTime64('1999-01-01 00:00:00.000', 3), 2000)─┐
│ 2000-01-01 │ 2000-01-01 00:00:00.000 │
└────────────────────────────────────────┴──────────────────────────────────────────────────────────────┘
```
## changeMonth
Changes the month component of a date or date time.
**Syntax**
``` sql
changeMonth(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the month. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- Returns a value of same type as `date_or_datetime`.
**Example**
``` sql
SELECT changeMonth(toDate('1999-01-01'), 2), changeMonth(toDateTime64('1999-01-01 00:00:00.000', 3), 2);
```
Result:
```
┌─changeMonth(toDate('1999-01-01'), 2)─┬─changeMonth(toDateTime64('1999-01-01 00:00:00.000', 3), 2)─┐
│ 1999-02-01 │ 1999-02-01 00:00:00.000 │
└──────────────────────────────────────┴────────────────────────────────────────────────────────────┘
```
## changeDay
Changes the day component of a date or date time.
**Syntax**
``` sql
changeDay(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the day. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- Returns a value of same type as `date_or_datetime`.
**Example**
``` sql
SELECT changeDay(toDate('1999-01-01'), 5), changeDay(toDateTime64('1999-01-01 00:00:00.000', 3), 5);
```
Result:
```
┌─changeDay(toDate('1999-01-01'), 5)─┬─changeDay(toDateTime64('1999-01-01 00:00:00.000', 3), 5)─┐
│ 1999-01-05 │ 1999-01-05 00:00:00.000 │
└────────────────────────────────────┴──────────────────────────────────────────────────────────┘
```
## changeHour
Changes the hour component of a date or date time.
**Syntax**
``` sql
changeHour(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the hour. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- Returns a value of same type as `date_or_datetime`. If the input is a [Date](../data-types/date.md), return [DateTime](../data-types/datetime.md). If the input is a [Date32](../data-types/date32.md), return [DateTime64](../data-types/datetime64.md).
**Example**
``` sql
SELECT changeHour(toDate('1999-01-01'), 14), changeHour(toDateTime64('1999-01-01 00:00:00.000', 3), 14);
```
Result:
```
┌─changeHour(toDate('1999-01-01'), 14)─┬─changeHour(toDateTime64('1999-01-01 00:00:00.000', 3), 14)─┐
│ 1999-01-01 14:00:00 │ 1999-01-01 14:00:00.000 │
└──────────────────────────────────────┴────────────────────────────────────────────────────────────┘
```
## changeMinute
Changes the minute component of a date or date time.
**Syntax**
``` sql
changeMinute(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the minute. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- Returns a value of same type as `date_or_datetime`. If the input is a [Date](../data-types/date.md), return [DateTime](../data-types/datetime.md). If the input is a [Date32](../data-types/date32.md), return [DateTime64](../data-types/datetime64.md).
**Example**
``` sql
SELECT changeMinute(toDate('1999-01-01'), 15), changeMinute(toDateTime64('1999-01-01 00:00:00.000', 3), 15);
```
Result:
```
┌─changeMinute(toDate('1999-01-01'), 15)─┬─changeMinute(toDateTime64('1999-01-01 00:00:00.000', 3), 15)─┐
│ 1999-01-01 00:15:00 │ 1999-01-01 00:15:00.000 │
└────────────────────────────────────────┴──────────────────────────────────────────────────────────────┘
```
## changeSecond
Changes the second component of a date or date time.
**Syntax**
``` sql
changeSecond(date_or_datetime, value)
```
**Arguments**
- `date_or_datetime` - a [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md)
- `value` - a new value of the second. [Integer](../../sql-reference/data-types/int-uint.md).
**Returned value**
- Returns a value of same type as `date_or_datetime`. If the input is a [Date](../data-types/date.md), return [DateTime](../data-types/datetime.md). If the input is a [Date32](../data-types/date32.md), return [DateTime64](../data-types/datetime64.md).
**Example**
``` sql
SELECT changeSecond(toDate('1999-01-01'), 15), changeSecond(toDateTime64('1999-01-01 00:00:00.000', 3), 15);
```
Result:
```
┌─changeSecond(toDate('1999-01-01'), 15)─┬─changeSecond(toDateTime64('1999-01-01 00:00:00.000', 3), 15)─┐
│ 1999-01-01 00:00:15 │ 1999-01-01 00:00:15.000 │
└────────────────────────────────────────┴──────────────────────────────────────────────────────────────┘
```
## addYears ## addYears
Adds a specified number of years to a date, a date with time or a string-encoded date / date with time. Adds a specified number of years to a date, a date with time or a string-encoded date / date with time.
@ -2714,6 +2912,7 @@ addYears(date, num)
- `num`: Number of years to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of years to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` years. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` years. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2751,6 +2950,7 @@ addQuarters(date, num)
- `num`: Number of quarters to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of quarters to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` quarters. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` quarters. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2788,6 +2988,7 @@ addMonths(date, num)
- `num`: Number of months to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of months to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` months. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` months. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2825,6 +3026,7 @@ addWeeks(date, num)
- `num`: Number of weeks to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of weeks to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` weeks. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` weeks. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2862,6 +3064,7 @@ addDays(date, num)
- `num`: Number of days to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of days to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` days. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` days. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2899,6 +3102,7 @@ addHours(date, num)
- `num`: Number of hours to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of hours to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
o
- Returns `date` plus `num` hours. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` hours. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2936,6 +3140,7 @@ addMinutes(date, num)
- `num`: Number of minutes to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of minutes to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` minutes. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` minutes. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -2973,6 +3178,7 @@ addSeconds(date, num)
- `num`: Number of seconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of seconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` plus `num` seconds. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` plus `num` seconds. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3010,6 +3216,7 @@ addMilliseconds(date_time, num)
- `num`: Number of milliseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of milliseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` plus `num` milliseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` plus `num` milliseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3045,6 +3252,7 @@ addMicroseconds(date_time, num)
- `num`: Number of microseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of microseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` plus `num` microseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` plus `num` microseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3080,6 +3288,7 @@ addNanoseconds(date_time, num)
- `num`: Number of nanoseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of nanoseconds to add. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` plus `num` nanoseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` plus `num` nanoseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3115,6 +3324,7 @@ addInterval(interval_1, interval_2)
- `interval_2`: Second interval to be added. [interval](../data-types/special-data-types/interval.md). - `interval_2`: Second interval to be added. [interval](../data-types/special-data-types/interval.md).
**Returned value** **Returned value**
- Returns a tuple of intervals. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)). - Returns a tuple of intervals. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)).
:::note :::note
@ -3161,6 +3371,7 @@ addTupleOfIntervals(interval_1, interval_2)
- `intervals`: Tuple of intervals to add to `date`. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)). - `intervals`: Tuple of intervals to add to `date`. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)).
**Returned value** **Returned value**
- Returns `date` with added `intervals`. [date](../data-types/date.md)/[date32](../data-types/date32.md)/[datetime](../data-types/datetime.md)/[datetime64](../data-types/datetime64.md). - Returns `date` with added `intervals`. [date](../data-types/date.md)/[date32](../data-types/date32.md)/[datetime](../data-types/datetime.md)/[datetime64](../data-types/datetime64.md).
**Example** **Example**
@ -3195,6 +3406,7 @@ subtractYears(date, num)
- `num`: Number of years to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of years to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` years. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` years. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3232,6 +3444,7 @@ subtractQuarters(date, num)
- `num`: Number of quarters to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of quarters to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` quarters. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` quarters. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3269,6 +3482,7 @@ subtractMonths(date, num)
- `num`: Number of months to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of months to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` months. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` months. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3306,6 +3520,7 @@ subtractWeeks(date, num)
- `num`: Number of weeks to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of weeks to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` weeks. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` weeks. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3343,6 +3558,7 @@ subtractDays(date, num)
- `num`: Number of days to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of days to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` days. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` days. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3380,6 +3596,7 @@ subtractHours(date, num)
- `num`: Number of hours to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of hours to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` hours. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[Datetime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` hours. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[Datetime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3417,6 +3634,7 @@ subtractMinutes(date, num)
- `num`: Number of minutes to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of minutes to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` minutes. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` minutes. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3454,6 +3672,7 @@ subtractSeconds(date, num)
- `num`: Number of seconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of seconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date` minus `num` seconds. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` minus `num` seconds. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3491,6 +3710,7 @@ subtractMilliseconds(date_time, num)
- `num`: Number of milliseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of milliseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` minus `num` milliseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` minus `num` milliseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3526,6 +3746,7 @@ subtractMicroseconds(date_time, num)
- `num`: Number of microseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of microseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` minus `num` microseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` minus `num` microseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3561,6 +3782,7 @@ subtractNanoseconds(date_time, num)
- `num`: Number of nanoseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md). - `num`: Number of nanoseconds to subtract. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value** **Returned value**
- Returns `date_time` minus `num` nanoseconds. [DateTime64](../data-types/datetime64.md). - Returns `date_time` minus `num` nanoseconds. [DateTime64](../data-types/datetime64.md).
**Example** **Example**
@ -3596,6 +3818,7 @@ subtractInterval(interval_1, interval_2)
- `interval_2`: Second interval to be negated. [interval](../data-types/special-data-types/interval.md). - `interval_2`: Second interval to be negated. [interval](../data-types/special-data-types/interval.md).
**Returned value** **Returned value**
- Returns a tuple of intervals. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)). - Returns a tuple of intervals. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)).
:::note :::note
@ -3642,6 +3865,7 @@ subtractTupleOfIntervals(interval_1, interval_2)
- `intervals`: Tuple of intervals to subtract from `date`. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)). - `intervals`: Tuple of intervals to subtract from `date`. [tuple](../data-types/tuple.md)([interval](../data-types/special-data-types/interval.md)).
**Returned value** **Returned value**
- Returns `date` with subtracted `intervals`. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md). - Returns `date` with subtracted `intervals`. [Date](../data-types/date.md)/[Date32](../data-types/date32.md)/[DateTime](../data-types/datetime.md)/[DateTime64](../data-types/datetime64.md).
**Example** **Example**

View File

@ -2984,6 +2984,66 @@ Result:
└─────────┘ └─────────┘
``` ```
## partitionID
Computes the [partition ID](../../engines/table-engines/mergetree-family/custom-partitioning-key.md).
:::note
This function is slow and should not be called for large amount of rows.
:::
**Syntax**
```sql
partitionID(x[, y, ...]);
```
**Arguments**
- `x` — Column for which to return the partition ID.
- `y, ...` — Remaining N columns for which to return the partition ID (optional).
**Returned Value**
- Partition ID that the row would belong to. [String](../data-types/string.md).
**Example**
Query:
```sql
DROP TABLE IF EXISTS tab;
CREATE TABLE tab
(
i int,
j int
)
ENGINE = MergeTree
PARTITION BY i
ORDER BY tuple();
INSERT INTO tab VALUES (1, 1), (1, 2), (1, 3), (2, 4), (2, 5), (2, 6);
SELECT i, j, partitionID(i), _partition_id FROM tab ORDER BY i, j;
```
Result:
```response
┌─i─┬─j─┬─partitionID(i)─┬─_partition_id─┐
│ 1 │ 1 │ 1 │ 1 │
│ 1 │ 2 │ 1 │ 1 │
│ 1 │ 3 │ 1 │ 1 │
└───┴───┴────────────────┴───────────────┘
┌─i─┬─j─┬─partitionID(i)─┬─_partition_id─┐
│ 2 │ 4 │ 2 │ 2 │
│ 2 │ 5 │ 2 │ 2 │
│ 2 │ 6 │ 2 │ 2 │
└───┴───┴────────────────┴───────────────┘
```
## shardNum ## shardNum
Returns the index of a shard which processes a part of data in a distributed query. Indices are started from `1`. Returns the index of a shard which processes a part of data in a distributed query. Indices are started from `1`.

View File

@ -24,9 +24,8 @@
#include <Common/TerminalSize.h> #include <Common/TerminalSize.h>
#include <Common/config_version.h> #include <Common/config_version.h>
#include <Common/formatReadable.h> #include <Common/formatReadable.h>
#include <Core/Settings.h>
#include <Columns/ColumnString.h> #include <Columns/ColumnString.h>
#include <Poco/Util/Application.h>
#include <IO/ReadBufferFromString.h> #include <IO/ReadBufferFromString.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
@ -49,6 +48,8 @@
#include <Formats/registerFormats.h> #include <Formats/registerFormats.h>
#include <Formats/FormatFactory.h> #include <Formats/FormatFactory.h>
#include <Poco/Util/Application.h>
namespace fs = std::filesystem; namespace fs = std::filesystem;
using namespace std::literals; using namespace std::literals;

View File

@ -1,5 +1,7 @@
#include "LibraryBridge.h" #include "LibraryBridge.h"
#include <iostream>
int mainEntryClickHouseLibraryBridge(int argc, char ** argv) int mainEntryClickHouseLibraryBridge(int argc, char ** argv)
{ {
DB::LibraryBridge app; DB::LibraryBridge app;

View File

@ -6,6 +6,7 @@
#include "ExternalDictionaryLibraryHandlerFactory.h" #include "ExternalDictionaryLibraryHandlerFactory.h"
#include <Formats/FormatFactory.h> #include <Formats/FormatFactory.h>
#include <IO/Operators.h>
#include <IO/ReadBufferFromString.h> #include <IO/ReadBufferFromString.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <Common/BridgeProtocolVersion.h> #include <Common/BridgeProtocolVersion.h>

View File

@ -3,11 +3,12 @@
#include <Client/ClientBase.h> #include <Client/ClientBase.h>
#include <Client/LocalConnection.h> #include <Client/LocalConnection.h>
#include <Common/StatusFile.h> #include <Core/ServerSettings.h>
#include <Common/InterruptListener.h>
#include <Loggers/Loggers.h>
#include <Core/Settings.h> #include <Core/Settings.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <Loggers/Loggers.h>
#include <Common/InterruptListener.h>
#include <Common/StatusFile.h>
#include <filesystem> #include <filesystem>
#include <memory> #include <memory>

View File

@ -2,6 +2,7 @@
#if USE_ODBC #if USE_ODBC
#include <Core/Settings.h>
#include <DataTypes/DataTypeFactory.h> #include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeNullable.h> #include <DataTypes/DataTypeNullable.h>
#include <Server/HTTP/WriteBufferFromHTTPServerResponse.h> #include <Server/HTTP/WriteBufferFromHTTPServerResponse.h>

View File

@ -11,6 +11,7 @@
#include <Poco/Net/HTTPServerResponse.h> #include <Poco/Net/HTTPServerResponse.h>
#include <Common/BridgeProtocolVersion.h> #include <Common/BridgeProtocolVersion.h>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <Core/Settings.h>
#include "getIdentifierQuote.h" #include "getIdentifierQuote.h"
#include "validateODBCConnectionString.h" #include "validateODBCConnectionString.h"
#include "ODBCPooledConnectionFactory.h" #include "ODBCPooledConnectionFactory.h"

View File

@ -9,6 +9,7 @@
#include <Server/HTTP/WriteBufferFromHTTPServerResponse.h> #include <Server/HTTP/WriteBufferFromHTTPServerResponse.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <Core/Settings.h>
#include <IO/ReadBufferFromIStream.h> #include <IO/ReadBufferFromIStream.h>
#include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h> #include <Poco/Net/HTTPServerResponse.h>

View File

@ -1,5 +1,7 @@
#include "ODBCBridge.h" #include "ODBCBridge.h"
#include <iostream>
int mainEntryClickHouseODBCBridge(int argc, char ** argv) int mainEntryClickHouseODBCBridge(int argc, char ** argv)
{ {
DB::ODBCBridge app; DB::ODBCBridge app;

View File

@ -2,8 +2,10 @@
#if USE_ODBC #if USE_ODBC
#include <Core/Settings.h>
#include <Server/HTTP/HTMLForm.h> #include <Server/HTTP/HTMLForm.h>
#include <Server/HTTP/WriteBufferFromHTTPServerResponse.h> #include <Server/HTTP/WriteBufferFromHTTPServerResponse.h>
#include <IO/Operators.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerRequest.h>

View File

@ -68,6 +68,7 @@
#include <Interpreters/registerInterpreters.h> #include <Interpreters/registerInterpreters.h>
#include <Interpreters/JIT/CompiledExpressionCache.h> #include <Interpreters/JIT/CompiledExpressionCache.h>
#include <Access/AccessControl.h> #include <Access/AccessControl.h>
#include <Storages/MergeTree/MergeTreeSettings.h>
#include <Storages/StorageReplicatedMergeTree.h> #include <Storages/StorageReplicatedMergeTree.h>
#include <Storages/System/attachSystemTables.h> #include <Storages/System/attachSystemTables.h>
#include <Storages/System/attachInformationSchemaTables.h> #include <Storages/System/attachInformationSchemaTables.h>

View File

@ -21,7 +21,6 @@
#include <Backups/BackupEntriesCollector.h> #include <Backups/BackupEntriesCollector.h>
#include <Backups/RestorerFromBackup.h> #include <Backups/RestorerFromBackup.h>
#include <Core/Settings.h> #include <Core/Settings.h>
#include <Storages/MergeTree/MergeTreeSettings.h>
#include <base/defines.h> #include <base/defines.h>
#include <IO/Operators.h> #include <IO/Operators.h>
#include <Common/re2.h> #include <Common/re2.h>

View File

@ -6,6 +6,7 @@
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <Common/CurrentThread.h> #include <Common/CurrentThread.h>
#include <Core/Settings.h>
static constexpr size_t MAX_AGGREGATE_FUNCTION_NAME_LENGTH = 1000; static constexpr size_t MAX_AGGREGATE_FUNCTION_NAME_LENGTH = 1000;

View File

@ -3,7 +3,6 @@
#include <base/scope_guard.h> #include <base/scope_guard.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <Core/Settings.h>
#include <Analyzer/IQueryTreeNode.h> #include <Analyzer/IQueryTreeNode.h>
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>

View File

@ -10,6 +10,8 @@
#include <Analyzer/TableNode.h> #include <Analyzer/TableNode.h>
#include <Analyzer/UnionNode.h> #include <Analyzer/UnionNode.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -11,6 +11,8 @@
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -11,6 +11,8 @@
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/LambdaNode.h> #include <Analyzer/LambdaNode.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -8,6 +8,8 @@
#include <Analyzer/TableExpressionModifiers.h> #include <Analyzer/TableExpressionModifiers.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -22,6 +22,8 @@
#include <Analyzer/HashUtils.h> #include <Analyzer/HashUtils.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -10,6 +10,8 @@
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Analyzer/HashUtils.h> #include <Analyzer/HashUtils.h>
#include <Core/Settings.h>
#include <Storages/IStorage.h> #include <Storages/IStorage.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>

View File

@ -11,6 +11,8 @@
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -9,13 +9,14 @@
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/ConstantNode.h> #include <Analyzer/ConstantNode.h>
#include <Analyzer/ColumnNode.h> #include <Analyzer/ColumnNode.h>
#include <Analyzer/Utils.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>
#include <Functions/IFunction.h> #include <Functions/IFunction.h>
#include <Functions/logical.h> #include <Functions/logical.h>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <Analyzer/Utils.h> #include <Core/Settings.h>
namespace DB namespace DB

View File

@ -21,6 +21,8 @@
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Analyzer/JoinNode.h> #include <Analyzer/JoinNode.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -1,6 +1,7 @@
#include <Analyzer/Passes/FuseFunctionsPass.h> #include <Analyzer/Passes/FuseFunctionsPass.h>
#include <Common/iota.h> #include <Common/iota.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypesNumber.h> #include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeArray.h> #include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeTuple.h> #include <DataTypes/DataTypeTuple.h>

View File

@ -1,6 +1,7 @@
#include <Analyzer/Passes/GroupingFunctionsResolvePass.h> #include <Analyzer/Passes/GroupingFunctionsResolvePass.h>
#include <Core/ColumnNumbers.h> #include <Core/ColumnNumbers.h>
#include <Core/Settings.h>
#include <Functions/grouping.h> #include <Functions/grouping.h>

View File

@ -4,6 +4,7 @@
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Core/Settings.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>
#include <Functions/multiIf.h> #include <Functions/multiIf.h>

View File

@ -5,6 +5,7 @@
#include <Analyzer/IQueryTreeNode.h> #include <Analyzer/IQueryTreeNode.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeArray.h> #include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeEnum.h> #include <DataTypes/DataTypeEnum.h>

View File

@ -8,6 +8,7 @@
#include <Analyzer/JoinNode.h> #include <Analyzer/JoinNode.h>
#include <Analyzer/HashUtils.h> #include <Analyzer/HashUtils.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeLowCardinality.h> #include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypesNumber.h> #include <DataTypes/DataTypesNumber.h>

View File

@ -2,6 +2,7 @@
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Core/Settings.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>
#include <Functions/if.h> #include <Functions/if.h>

View File

@ -7,6 +7,7 @@
#include <Analyzer/ConstantNode.h> #include <Analyzer/ConstantNode.h>
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <DataTypes/DataTypesNumber.h> #include <DataTypes/DataTypesNumber.h>

View File

@ -9,6 +9,7 @@
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Common/DateLUT.h> #include <Common/DateLUT.h>
#include <Common/DateLUTImpl.h> #include <Common/DateLUTImpl.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -8,6 +8,7 @@
#include <Analyzer/IQueryTreeNode.h> #include <Analyzer/IQueryTreeNode.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -3,6 +3,7 @@
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/IQueryTreeNode.h> #include <Analyzer/IQueryTreeNode.h>
#include <Core/Settings.h>
#include <DataTypes/IDataType.h> #include <DataTypes/IDataType.h>
#include <Interpreters/ExternalDictionariesLoader.h> #include <Interpreters/ExternalDictionariesLoader.h>

View File

@ -8,6 +8,7 @@
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>
#include <Analyzer/SortNode.h> #include <Analyzer/SortNode.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -6,6 +6,8 @@
#include <AggregateFunctions/AggregateFunctionFactory.h> #include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/IAggregateFunction.h> #include <AggregateFunctions/IAggregateFunction.h>
#include <Core/Settings.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>

View File

@ -6,6 +6,7 @@
#include <Analyzer/ConstantNode.h> #include <Analyzer/ConstantNode.h>
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <Functions/FunctionFactory.h> #include <Functions/FunctionFactory.h>
namespace DB namespace DB

View File

@ -1,19 +1,16 @@
#include <Analyzer/Passes/SumIfToCountIfPass.h> #include <Analyzer/Passes/SumIfToCountIfPass.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeNullable.h>
#include <AggregateFunctions/AggregateFunctionFactory.h> #include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/IAggregateFunction.h> #include <AggregateFunctions/IAggregateFunction.h>
#include <Analyzer/Utils.h>
#include <Functions/FunctionFactory.h>
#include <Interpreters/Context.h>
#include <Analyzer/InDepthQueryTreeVisitor.h> #include <Analyzer/InDepthQueryTreeVisitor.h>
#include <Analyzer/ConstantNode.h> #include <Analyzer/ConstantNode.h>
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeNullable.h>
#include <Functions/FunctionFactory.h>
#include <Interpreters/Context.h>
namespace DB namespace DB
{ {

View File

@ -9,6 +9,8 @@
#include <Analyzer/FunctionNode.h> #include <Analyzer/FunctionNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -9,6 +9,8 @@
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -40,6 +40,8 @@
#include <Analyzer/JoinNode.h> #include <Analyzer/JoinNode.h>
#include <Analyzer/UnionNode.h> #include <Analyzer/UnionNode.h>
#include <Core/Settings.h>
#include <Databases/IDatabase.h> #include <Databases/IDatabase.h>
#include <Interpreters/StorageID.h> #include <Interpreters/StorageID.h>

View File

@ -1,8 +1,9 @@
#include <Analyzer/Resolve/IdentifierResolveScope.h> #include <Analyzer/Resolve/IdentifierResolveScope.h>
#include <Interpreters/Context.h>
#include <Analyzer/QueryNode.h> #include <Analyzer/QueryNode.h>
#include <Analyzer/UnionNode.h> #include <Analyzer/UnionNode.h>
#include <Core/Settings.h>
#include <Interpreters/Context.h>
namespace DB namespace DB
{ {

View File

@ -25,6 +25,8 @@
#include <Analyzer/Resolve/IdentifierResolveScope.h> #include <Analyzer/Resolve/IdentifierResolveScope.h>
#include <Analyzer/Resolve/ReplaceColumnsVisitor.h> #include <Analyzer/Resolve/ReplaceColumnsVisitor.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {
namespace ErrorCodes namespace ErrorCodes

View File

@ -64,6 +64,8 @@
#include <Analyzer/Resolve/TableExpressionsAliasVisitor.h> #include <Analyzer/Resolve/TableExpressionsAliasVisitor.h>
#include <Analyzer/Resolve/ReplaceColumnsVisitor.h> #include <Analyzer/Resolve/ReplaceColumnsVisitor.h>
#include <Core/Settings.h>
namespace ProfileEvents namespace ProfileEvents
{ {
extern const Event ScalarSubqueriesGlobalCacheHit; extern const Event ScalarSubqueriesGlobalCacheHit;
@ -1490,6 +1492,10 @@ void QueryAnalyzer::qualifyColumnNodesWithProjectionNames(const QueryTreeNodes &
additional_column_qualification_parts = {table_expression_node->getAlias()}; additional_column_qualification_parts = {table_expression_node->getAlias()};
else if (auto * table_node = table_expression_node->as<TableNode>()) else if (auto * table_node = table_expression_node->as<TableNode>())
additional_column_qualification_parts = {table_node->getStorageID().getDatabaseName(), table_node->getStorageID().getTableName()}; additional_column_qualification_parts = {table_node->getStorageID().getDatabaseName(), table_node->getStorageID().getTableName()};
else if (auto * query_node = table_expression_node->as<QueryNode>(); query_node && query_node->isCTE())
additional_column_qualification_parts = {query_node->getCTEName()};
else if (auto * union_node = table_expression_node->as<UnionNode>(); union_node && union_node->isCTE())
additional_column_qualification_parts = {union_node->getCTEName()};
size_t additional_column_qualification_parts_size = additional_column_qualification_parts.size(); size_t additional_column_qualification_parts_size = additional_column_qualification_parts.size();
const auto & table_expression_data = scope.getTableExpressionDataOrThrow(table_expression_node); const auto & table_expression_data = scope.getTableExpressionDataOrThrow(table_expression_node);
@ -4455,8 +4461,7 @@ void QueryAnalyzer::initializeTableExpressionData(const QueryTreeNodePtr & table
{ {
auto left_table_expression = extractLeftTableExpression(scope_query_node->getJoinTree()); auto left_table_expression = extractLeftTableExpression(scope_query_node->getJoinTree());
if (table_expression_node.get() == left_table_expression.get() && if (table_expression_node.get() == left_table_expression.get() &&
scope.joins_count == 1 && scope.joins_count == 1 && scope.context->getSettingsRef().single_join_prefer_left_table)
scope.context->getSettingsRef().single_join_prefer_left_table)
table_expression_data.should_qualify_columns = false; table_expression_data.should_qualify_columns = false;
} }

View File

@ -10,6 +10,8 @@
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <Core/Settings.h>
namespace DB namespace DB
{ {

View File

@ -1,5 +1,7 @@
#include <Analyzer/Utils.h> #include <Analyzer/Utils.h>
#include <Core/Settings.h>
#include <Parsers/ASTTablesInSelectQuery.h> #include <Parsers/ASTTablesInSelectQuery.h>
#include <Parsers/ASTIdentifier.h> #include <Parsers/ASTIdentifier.h>
#include <Parsers/ASTSubquery.h> #include <Parsers/ASTSubquery.h>

View File

@ -17,6 +17,7 @@
#include <base/scope_guard.h> #include <base/scope_guard.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <Common/escapeForFileName.h> #include <Common/escapeForFileName.h>
#include <Core/Settings.h>
#include <boost/range/adaptor/map.hpp> #include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp> #include <boost/range/algorithm/copy.hpp>

View File

@ -1,6 +1,7 @@
#include <Backups/BackupIO_S3.h> #include <Backups/BackupIO_S3.h>
#if USE_AWS_S3 #if USE_AWS_S3
#include <Core/Settings.h>
#include <Common/quoteString.h> #include <Common/quoteString.h>
#include <Common/threadPoolCallbackRunner.h> #include <Common/threadPoolCallbackRunner.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>

View File

@ -26,6 +26,7 @@
#include <Common/setThreadName.h> #include <Common/setThreadName.h>
#include <Common/scope_guard_safe.h> #include <Common/scope_guard_safe.h>
#include <Common/ThreadPool.h> #include <Common/ThreadPool.h>
#include <Core/Settings.h>
#include <boost/range/adaptor/map.hpp> #include <boost/range/adaptor/map.hpp>

View File

@ -1,11 +1,11 @@
#include <Backups/DDLAdjustingForBackupVisitor.h> #include <Backups/DDLAdjustingForBackupVisitor.h>
#include <Core/ServerSettings.h>
#include <Interpreters/Context.h>
#include <Parsers/ASTCreateQuery.h> #include <Parsers/ASTCreateQuery.h>
#include <Parsers/ASTFunction.h> #include <Parsers/ASTFunction.h>
#include <Parsers/ASTLiteral.h> #include <Parsers/ASTLiteral.h>
#include <Interpreters/Context.h>
#include <Storages/StorageReplicatedMergeTree.h>
#include <Parsers/formatAST.h> #include <Parsers/formatAST.h>
#include <Storages/StorageReplicatedMergeTree.h>
namespace DB namespace DB

View File

@ -23,8 +23,9 @@
#include <Common/quoteString.h> #include <Common/quoteString.h>
#include <Common/escapeForFileName.h> #include <Common/escapeForFileName.h>
#include <base/insertAtEnd.h> #include <base/insertAtEnd.h>
#include <boost/algorithm/string/join.hpp> #include <Core/Settings.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/adaptor/map.hpp> #include <boost/range/adaptor/map.hpp>
#include <filesystem> #include <filesystem>

View File

@ -1,5 +1,7 @@
#include <mutex>
#include <Backups/WithRetries.h> #include <Backups/WithRetries.h>
#include <Core/Settings.h>
#include <mutex>
namespace DB namespace DB
{ {

View File

@ -8,6 +8,7 @@
#include <Common/SensitiveDataMasker.h> #include <Common/SensitiveDataMasker.h>
#include <Common/StringUtils.h> #include <Common/StringUtils.h>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <Core/Settings.h>
#include <Formats/registerFormats.h> #include <Formats/registerFormats.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <IO/WriteBufferFromFile.h> #include <IO/WriteBufferFromFile.h>

View File

@ -1,5 +1,7 @@
#include "LibraryBridgeHelper.h" #include "LibraryBridgeHelper.h"
#include <Core/ServerSettings.h>
#include <Core/Settings.h>
#include <IO/ConnectionTimeouts.h> #include <IO/ConnectionTimeouts.h>
namespace DB namespace DB

View File

@ -10,6 +10,7 @@
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>
#include <Common/DNSResolver.h> #include <Common/DNSResolver.h>
#include <Core/ExternalTable.h> #include <Core/ExternalTable.h>
#include <Core/Settings.h>
#include <Poco/Util/Application.h> #include <Poco/Util/Application.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <Client/Suggest.h> #include <Client/Suggest.h>

View File

@ -1,6 +1,7 @@
#include <Client/ConnectionEstablisher.h> #include <Client/ConnectionEstablisher.h>
#include <Common/quoteString.h> #include <Common/quoteString.h>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Core/Settings.h>
namespace ProfileEvents namespace ProfileEvents
{ {

View File

@ -1,4 +1,5 @@
#include <Client/ConnectionPool.h> #include <Client/ConnectionPool.h>
#include <Core/Settings.h>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
@ -85,4 +86,15 @@ ConnectionPoolFactory & ConnectionPoolFactory::instance()
return ret; return ret;
} }
IConnectionPool::Entry ConnectionPool::get(const DB::ConnectionTimeouts& timeouts, const DB::Settings& settings,
bool force_connected)
{
Entry entry = Base::get(settings.connection_pool_max_wait_ms.totalMilliseconds());
if (force_connected)
entry->forceConnected(timeouts);
return entry;
}
} }

View File

@ -4,12 +4,13 @@
#include <Common/Priority.h> #include <Common/Priority.h>
#include <Client/Connection.h> #include <Client/Connection.h>
#include <IO/ConnectionTimeouts.h> #include <IO/ConnectionTimeouts.h>
#include <Core/Settings.h>
#include <base/defines.h> #include <base/defines.h>
namespace DB namespace DB
{ {
struct Settings;
/** Interface for connection pools. /** Interface for connection pools.
* *
* Usage (using the usual `ConnectionPool` example) * Usage (using the usual `ConnectionPool` example)
@ -102,15 +103,7 @@ public:
Entry get(const ConnectionTimeouts & timeouts, /// NOLINT Entry get(const ConnectionTimeouts & timeouts, /// NOLINT
const Settings & settings, const Settings & settings,
bool force_connected = true) override bool force_connected = true) override;
{
Entry entry = Base::get(settings.connection_pool_max_wait_ms.totalMilliseconds());
if (force_connected)
entry->forceConnected(timeouts);
return entry;
}
std::string getDescription() const std::string getDescription() const
{ {

View File

@ -3,6 +3,7 @@
#include <Client/HedgedConnections.h> #include <Client/HedgedConnections.h>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Core/Settings.h>
#include <Interpreters/ClientInfo.h> #include <Interpreters/ClientInfo.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>

View File

@ -8,13 +8,14 @@
#include <Common/Fiber.h> #include <Common/Fiber.h>
#include <Client/ConnectionEstablisher.h> #include <Client/ConnectionEstablisher.h>
#include <Client/ConnectionPoolWithFailover.h> #include <Client/ConnectionPoolWithFailover.h>
#include <Core/Settings.h>
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
namespace DB namespace DB
{ {
struct Settings;
/** Class for establishing hedged connections with replicas. /** Class for establishing hedged connections with replicas.
* The process of establishing connection is divided on stages, on each stage if * The process of establishing connection is divided on stages, on each stage if
* replica doesn't respond for a long time, we start establishing connection with * replica doesn't respond for a long time, we start establishing connection with

View File

@ -2,6 +2,7 @@
#include <Common/thread_local_rng.h> #include <Common/thread_local_rng.h>
#include <Core/Protocol.h> #include <Core/Protocol.h>
#include <Core/Settings.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <IO/ConnectionTimeouts.h> #include <IO/ConnectionTimeouts.h>
#include <IO/Operators.h> #include <IO/Operators.h>

View File

@ -2,7 +2,9 @@
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <Common/CurrentThread.h> #include <Common/CurrentThread.h>
#include <Common/DateLUTImpl.h>
#include <Common/filesystemHelpers.h> #include <Common/filesystemHelpers.h>
#include <Core/Settings.h>
#include <Poco/DigestStream.h> #include <Poco/DigestStream.h>
#include <Poco/Exception.h> #include <Poco/Exception.h>

View File

@ -1,3 +1,4 @@
#include <Common/Exception.h>
#include <Common/GetPriorityForLoadBalancing.h> #include <Common/GetPriorityForLoadBalancing.h>
#include <Common/Priority.h> #include <Common/Priority.h>

View File

@ -1,6 +1,10 @@
#pragma once #pragma once
#include <Core/SettingsEnums.h> #include <Common/Priority.h>
#include <Core/LoadBalancing.h>
#include <functional>
#include <vector>
namespace DB namespace DB
{ {

View File

@ -1,6 +1,7 @@
#include <Common/NamedCollections/NamedCollectionsFactory.h> #include <Common/NamedCollections/NamedCollectionsFactory.h>
#include <Common/NamedCollections/NamedCollectionConfiguration.h> #include <Common/NamedCollections/NamedCollectionConfiguration.h>
#include <Common/NamedCollections/NamedCollectionsMetadataStorage.h> #include <Common/NamedCollections/NamedCollectionsMetadataStorage.h>
#include <Core/Settings.h>
#include <base/sleep.h> #include <base/sleep.h>
namespace DB namespace DB

View File

@ -5,6 +5,7 @@
#include <Common/ZooKeeper/IKeeper.h> #include <Common/ZooKeeper/IKeeper.h>
#include <Common/ZooKeeper/KeeperException.h> #include <Common/ZooKeeper/KeeperException.h>
#include <Common/ZooKeeper/ZooKeeper.h> #include <Common/ZooKeeper/ZooKeeper.h>
#include <Core/Settings.h>
#include <IO/WriteBufferFromFile.h> #include <IO/WriteBufferFromFile.h>
#include <IO/ReadBufferFromFile.h> #include <IO/ReadBufferFromFile.h>
#include <IO/WriteHelpers.h> #include <IO/WriteHelpers.h>

View File

@ -508,6 +508,7 @@ The server successfully detected this situation and will download merged part fr
M(FileSegmentHolderCompleteMicroseconds, "File segments holder complete() time") \ M(FileSegmentHolderCompleteMicroseconds, "File segments holder complete() time") \
M(FileSegmentFailToIncreasePriority, "Number of times the priority was not increased due to a high contention on the cache lock") \ M(FileSegmentFailToIncreasePriority, "Number of times the priority was not increased due to a high contention on the cache lock") \
M(FilesystemCacheFailToReserveSpaceBecauseOfLockContention, "Number of times space reservation was skipped due to a high contention on the cache lock") \ M(FilesystemCacheFailToReserveSpaceBecauseOfLockContention, "Number of times space reservation was skipped due to a high contention on the cache lock") \
M(FilesystemCacheFailToReserveSpaceBecauseOfCacheResize, "Number of times space reservation was skipped due to the cache is being resized") \
M(FilesystemCacheHoldFileSegments, "Filesystem cache file segments count, which were hold") \ M(FilesystemCacheHoldFileSegments, "Filesystem cache file segments count, which were hold") \
M(FilesystemCacheUnusedHoldFileSegments, "Filesystem cache file segments count, which were hold, but not used (because of seek or LIMIT n, etc)") \ M(FilesystemCacheUnusedHoldFileSegments, "Filesystem cache file segments count, which were hold, but not used (because of seek or LIMIT n, etc)") \
M(FilesystemCacheFreeSpaceKeepingThreadRun, "Number of times background thread executed free space keeping job") \ M(FilesystemCacheFreeSpaceKeepingThreadRun, "Number of times background thread executed free space keeping job") \

View File

@ -1,6 +1,7 @@
#include "ProgressIndication.h" #include "ProgressIndication.h"
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <iostream>
#include <numeric> #include <numeric>
#include <filesystem> #include <filesystem>
#include <cmath> #include <cmath>

View File

@ -1,14 +1,15 @@
#pragma once #pragma once
#include <unordered_map>
#include <unordered_set>
#include <mutex>
#include <IO/Progress.h> #include <IO/Progress.h>
#include <Interpreters/Context.h> #include <Interpreters/Context.h>
#include <base/types.h> #include <base/types.h>
#include <Common/Stopwatch.h> #include <Common/Stopwatch.h>
#include <Common/EventRateMeter.h> #include <Common/EventRateMeter.h>
#include <iostream>
#include <mutex>
#include <unordered_map>
#include <unordered_set>
namespace DB namespace DB
{ {

View File

@ -12,13 +12,14 @@
#include <base/sleep.h> #include <base/sleep.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <Common/logger_useful.h>
#include <Common/CurrentMemoryTracker.h>
#include <Common/Exception.h> #include <Common/Exception.h>
#include <Common/MemoryTracker.h> #include <Common/MemoryTracker.h>
#include <Common/ThreadFuzzer.h>
#include <Common/logger_useful.h>
#include <Common/thread_local_rng.h> #include <Common/thread_local_rng.h>
#include <Common/ThreadFuzzer.h>
#include "config.h" // USE_JEMALLOC #include "config.h" // USE_JEMALLOC

View File

@ -1,5 +1,6 @@
#include <Coordination/FourLetterCommand.h> #include <Coordination/FourLetterCommand.h>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/KeeperDispatcher.h> #include <Coordination/KeeperDispatcher.h>
#include <Server/KeeperTCPHandler.h> #include <Server/KeeperTCPHandler.h>
#include <Common/ZooKeeper/IKeeper.h> #include <Common/ZooKeeper/IKeeper.h>

View File

@ -3,6 +3,7 @@
#include <Coordination/KeeperContext.h> #include <Coordination/KeeperContext.h>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/Defines.h> #include <Coordination/Defines.h>
#include <Coordination/KeeperConstants.h> #include <Coordination/KeeperConstants.h>
#include <Server/CloudPlacementInfo.h> #include <Server/CloudPlacementInfo.h>

View File

@ -5,8 +5,8 @@
#include <Poco/Util/AbstractConfiguration.h> #include <Poco/Util/AbstractConfiguration.h>
#include <base/hex.h> #include <base/hex.h>
#include "Common/ZooKeeper/IKeeper.h" #include <Common/ZooKeeper/IKeeper.h>
#include "Common/ZooKeeper/ZooKeeperCommon.h" #include <Common/ZooKeeper/ZooKeeperCommon.h>
#include <Common/setThreadName.h> #include <Common/setThreadName.h>
#include <Common/ZooKeeper/KeeperException.h> #include <Common/ZooKeeper/KeeperException.h>
#include <Common/checkStackSize.h> #include <Common/checkStackSize.h>
@ -14,6 +14,7 @@
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Common/logger_useful.h> #include <Common/logger_useful.h>
#include <Common/formatReadable.h> #include <Common/formatReadable.h>
#include <Coordination/CoordinationSettings.h>
#include <Disks/IDisk.h> #include <Disks/IDisk.h>

View File

@ -11,7 +11,6 @@
#include <Common/Exception.h> #include <Common/Exception.h>
#include <functional> #include <functional>
#include <Coordination/KeeperServer.h> #include <Coordination/KeeperServer.h>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/Keeper4LWInfo.h> #include <Coordination/Keeper4LWInfo.h>
#include <Coordination/KeeperConnectionStats.h> #include <Coordination/KeeperConnectionStats.h>
#include <Coordination/KeeperSnapshotManagerS3.h> #include <Coordination/KeeperSnapshotManagerS3.h>

View File

@ -3,9 +3,7 @@
#include "config.h" #include "config.h"
#include <chrono> #include <Coordination/CoordinationSettings.h>
#include <mutex>
#include <string>
#include <Coordination/KeeperLogStore.h> #include <Coordination/KeeperLogStore.h>
#include <Coordination/KeeperSnapshotManagerS3.h> #include <Coordination/KeeperSnapshotManagerS3.h>
#include <Coordination/KeeperStateMachine.h> #include <Coordination/KeeperStateMachine.h>
@ -30,6 +28,10 @@
#include <Common/getMultipleKeysFromConfig.h> #include <Common/getMultipleKeysFromConfig.h>
#include <Common/getNumberOfPhysicalCPUCores.h> #include <Common/getNumberOfPhysicalCPUCores.h>
#include <chrono>
#include <mutex>
#include <string>
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <fmt/chrono.h> #include <fmt/chrono.h>

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <Coordination/CoordinationSettings.h>
#include <Coordination/InMemoryLogStore.h> #include <Coordination/InMemoryLogStore.h>
#include <Coordination/KeeperStateMachine.h> #include <Coordination/KeeperStateMachine.h>
#include <Coordination/KeeperStateManager.h> #include <Coordination/KeeperStateManager.h>
@ -17,6 +16,9 @@ namespace DB
using RaftAppendResult = nuraft::ptr<nuraft::cmd_result<nuraft::ptr<nuraft::buffer>>>; using RaftAppendResult = nuraft::ptr<nuraft::cmd_result<nuraft::ptr<nuraft::buffer>>>;
struct KeeperConfigurationAndSettings;
using KeeperConfigurationAndSettingsPtr = std::shared_ptr<KeeperConfigurationAndSettings>;
class KeeperServer class KeeperServer
{ {
private: private:

View File

@ -1,6 +1,7 @@
#include <atomic> #include <atomic>
#include <cerrno> #include <cerrno>
#include <chrono> #include <chrono>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/KeeperDispatcher.h> #include <Coordination/KeeperDispatcher.h>
#include <Coordination/KeeperReconfiguration.h> #include <Coordination/KeeperReconfiguration.h>
#include <Coordination/KeeperSnapshotManager.h> #include <Coordination/KeeperSnapshotManager.h>

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <Coordination/CoordinationSettings.h>
#include <Coordination/KeeperSnapshotManager.h> #include <Coordination/KeeperSnapshotManager.h>
#include <Coordination/KeeperSnapshotManagerS3.h> #include <Coordination/KeeperSnapshotManagerS3.h>
#include <Coordination/KeeperContext.h> #include <Coordination/KeeperContext.h>

View File

@ -1,14 +1,13 @@
#pragma once #pragma once
#include <Core/Types.h>
#include <string> #include <string>
#include <Coordination/KeeperLogStore.h> #include <Coordination/KeeperLogStore.h>
#include <Coordination/CoordinationSettings.h> #include <Coordination/KeeperSnapshotManager.h>
#include <Core/Types.h>
#include <libnuraft/nuraft.hxx> #include <libnuraft/nuraft.hxx>
#include <Poco/Util/AbstractConfiguration.h> #include <Poco/Util/AbstractConfiguration.h>
#include "Coordination/KeeperStateMachine.h" #include "Coordination/KeeperStateMachine.h"
#include "Coordination/RaftServerConfig.h" #include "Coordination/RaftServerConfig.h"
#include <Coordination/KeeperSnapshotManager.h>
namespace DB namespace DB
{ {

View File

@ -20,11 +20,12 @@
#include <Common/LockMemoryExceptionInThread.h> #include <Common/LockMemoryExceptionInThread.h>
#include <Common/ProfileEvents.h> #include <Common/ProfileEvents.h>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/KeeperCommon.h> #include <Coordination/KeeperCommon.h>
#include <Coordination/KeeperConstants.h> #include <Coordination/KeeperConstants.h>
#include <Coordination/KeeperDispatcher.h>
#include <Coordination/KeeperReconfiguration.h> #include <Coordination/KeeperReconfiguration.h>
#include <Coordination/KeeperStorage.h> #include <Coordination/KeeperStorage.h>
#include <Coordination/KeeperDispatcher.h>
#include <functional> #include <functional>
#include <base/defines.h> #include <base/defines.h>

View File

@ -7,6 +7,7 @@
#include <filesystem> #include <filesystem>
#include <thread> #include <thread>
#include <Coordination/Changelog.h> #include <Coordination/Changelog.h>
#include <Coordination/CoordinationSettings.h>
#include <Coordination/InMemoryLogStore.h> #include <Coordination/InMemoryLogStore.h>
#include <Coordination/KeeperContext.h> #include <Coordination/KeeperContext.h>
#include <Coordination/KeeperConstants.h> #include <Coordination/KeeperConstants.h>

View File

@ -16,6 +16,7 @@
#include <QueryPipeline/QueryPipelineBuilder.h> #include <QueryPipeline/QueryPipelineBuilder.h>
#include <Core/ExternalTable.h> #include <Core/ExternalTable.h>
#include <Core/Settings.h>
#include <Poco/Net/MessageHeader.h> #include <Poco/Net/MessageHeader.h>
#include <Parsers/ASTNameTypePair.h> #include <Parsers/ASTNameTypePair.h>
#include <Parsers/ParserCreateQuery.h> #include <Parsers/ParserCreateQuery.h>

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