diff --git a/.clang-tidy b/.clang-tidy
index 219ac263ab3..896052915f7 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -37,6 +37,7 @@ Checks: [
'-cert-oop54-cpp',
'-cert-oop57-cpp',
+ '-clang-analyzer-optin.core.EnumCastOutOfRange', # https://github.com/abseil/abseil-cpp/issues/1667
'-clang-analyzer-optin.performance.Padding',
'-clang-analyzer-unix.Malloc',
@@ -94,6 +95,7 @@ Checks: [
'-modernize-pass-by-value',
'-modernize-return-braced-init-list',
'-modernize-use-auto',
+ '-modernize-use-constraints', # This is a good check, but clang-tidy crashes, see https://github.com/llvm/llvm-project/issues/91872
'-modernize-use-default-member-init',
'-modernize-use-emplace',
'-modernize-use-nodiscard',
@@ -121,7 +123,8 @@ Checks: [
'-readability-magic-numbers',
'-readability-named-parameter',
'-readability-redundant-declaration',
- '-readability-redundant-inline-specifier',
+ '-readability-redundant-inline-specifier', # useful but incompatible with __attribute((always_inline))__ (aka. ALWAYS_INLINE, base/base/defines.h).
+ # ALWAYS_INLINE only has an effect if combined with `inline`: https://godbolt.org/z/Eefd74qdM
'-readability-redundant-member-init', # Useful but triggers another problem. Imagine a struct S with multiple String members. Structs are often instantiated via designated
# initializer S s{.s1 = [...], .s2 = [...], [...]}. In this case, compiler warning `missing-field-initializers` requires to specify all members which are not in-struct
# initialized (example: s1 in struct S { String s1; String s2{};}; is not in-struct initialized, therefore it must be specified at instantiation time). As explicitly
@@ -132,12 +135,7 @@ Checks: [
'-readability-uppercase-literal-suffix',
'-readability-use-anyofallof',
- '-zircon-*',
-
- # This is a good check, but clang-tidy crashes, see https://github.com/llvm/llvm-project/issues/91872
- '-modernize-use-constraints',
- # https://github.com/abseil/abseil-cpp/issues/1667
- '-clang-analyzer-optin.core.EnumCastOutOfRange'
+ '-zircon-*'
]
WarningsAsErrors: '*'
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 3e0131a388a..f9765c1d57b 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -42,47 +42,39 @@ At a minimum, the following information should be added (but add more as needed)
> Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/
- Modify your CI run
+ CI Settings
**NOTE:** If your merge the PR with modified CI you **MUST KNOW** what you are doing
**NOTE:** Checked options will be applied if set before CI RunConfig/PrepareRunConfig step
-
-#### Include tests (required builds will be added automatically):
-- [ ] Fast test
-- [ ] Integration Tests
-- [ ] Stateless tests
-- [ ] Stateful tests
-- [ ] Unit tests
-- [ ] Performance tests
-- [ ] All with ASAN
-- [ ] All with TSAN
-- [ ] All with Analyzer
-- [ ] All with Azure
-- [ ] Add your option here
-
-#### Exclude tests:
-- [ ] Fast test
-- [ ] Integration Tests
-- [ ] Stateless tests
-- [ ] Stateful tests
-- [ ] Performance tests
-- [ ] All with ASAN
-- [ ] All with TSAN
-- [ ] All with MSAN
-- [ ] All with UBSAN
-- [ ] All with Coverage
-- [ ] All with Aarch64
-- [ ] Add your option here
-
-#### Extra options:
+- [ ] Allow: Integration Tests
+- [ ] Allow: Stateless tests
+- [ ] Allow: Stateful tests
+- [ ] Allow: Unit tests
+- [ ] Allow: Performance tests
+- [ ] Allow: All with aarch64
+- [ ] Allow: All with ASAN
+- [ ] Allow: All with TSAN
+- [ ] Allow: All with Analyzer
+- [ ] Allow: All with Azure
+- [ ] Allow: Add your option here
+---
+- [ ] Exclude: Fast test
+- [ ] Exclude: Integration Tests
+- [ ] Exclude: Stateless tests
+- [ ] Exclude: Stateful tests
+- [ ] Exclude: Performance tests
+- [ ] Exclude: All with ASAN
+- [ ] Exclude: All with TSAN
+- [ ] Exclude: All with MSAN
+- [ ] Exclude: All with UBSAN
+- [ ] Exclude: All with Coverage
+- [ ] Exclude: All with Aarch64
+---
- [ ] do not test (only style check)
- [ ] disable merge-commit (no merge from master before tests)
- [ ] disable CI cache (job reuse)
-
-#### Only specified batches in multi-batch jobs:
-- [ ] 1
-- [ ] 2
-- [ ] 3
-- [ ] 4
-
+- [ ] allow: batch 1 for multi-batch jobs
+- [ ] allow: batch 2
+- [ ] allow: batch 3
+- [ ] allow: batch 4, 5 and 6
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index d2ea714e4e4..c2a893a8e99 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -27,15 +27,16 @@ jobs:
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 sync_pr.py --merge || :
- - name: Python unit tests
- run: |
- cd "$GITHUB_WORKSPACE/tests/ci"
- echo "Testing the main ci directory"
- python3 -m unittest discover -s . -p 'test_*.py'
- for dir in *_lambda/; do
- echo "Testing $dir"
- python3 -m unittest discover -s "$dir" -p 'test_*.py'
- done
+# Runs in MQ:
+# - name: Python unit tests
+# run: |
+# cd "$GITHUB_WORKSPACE/tests/ci"
+# echo "Testing the main ci directory"
+# python3 -m unittest discover -s . -p 'test_*.py'
+# for dir in *_lambda/; do
+# echo "Testing $dir"
+# python3 -m unittest discover -s "$dir" -p 'test_*.py'
+# done
- name: PrepareRunConfig
id: runconfig
run: |
@@ -53,13 +54,13 @@ jobs:
- name: Re-create GH statuses for skipped jobs if any
run: |
python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --infile ${{ runner.temp }}/ci_run_data.json --update-gh-statuses
- BuildDockers:
- needs: [RunConfig]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_docker.yml
- with:
- data: ${{ needs.RunConfig.outputs.data }}
- # Tested in MQ
+# Runs in MQ:
+# BuildDockers:
+# needs: [RunConfig]
+# if: ${{ !failure() && !cancelled() }}
+# uses: ./.github/workflows/reusable_docker.yml
+# with:
+# data: ${{ needs.RunConfig.outputs.data }}
# StyleCheck:
# needs: [RunConfig, BuildDockers]
# if: ${{ !failure() && !cancelled() }}
@@ -70,262 +71,73 @@ jobs:
# data: ${{ needs.RunConfig.outputs.data }}
# run_command: |
# python3 style_check.py --no-push
- CompatibilityCheckX86:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
+
+ ################################# Main stages #################################
+ # for main CI chain
+ #
+ Builds_1:
+ needs: [RunConfig]
+ if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }}
+ # using callable wf (reusable_stage.yml) allows grouping all nested jobs under a tab
+ uses: ./.github/workflows/reusable_build_stage.yml
with:
- test_name: Compatibility check (amd64)
- runner_type: style-checker
+ stage: Builds_1
data: ${{ needs.RunConfig.outputs.data }}
- CompatibilityCheckAarch64:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
+ Tests_1:
+ needs: [RunConfig, Builds_1]
+ if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_1') }}
+ uses: ./.github/workflows/reusable_test_stage.yml
with:
- test_name: Compatibility check (aarch64)
- runner_type: style-checker
+ stage: Tests_1
data: ${{ needs.RunConfig.outputs.data }}
-#########################################################################################
-#################################### ORDINARY BUILDS ####################################
-#########################################################################################
-# TODO: never skip builds!
- BuilderDebRelease:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
+ Builds_2:
+ needs: [RunConfig, Builds_1]
+ if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_2') }}
+ uses: ./.github/workflows/reusable_build_stage.yml
with:
- build_name: package_release
- checkout_depth: 0
+ stage: Builds_2
data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebReleaseCoverage:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
+ Tests_2:
+ needs: [RunConfig, Builds_2]
+ if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }}
+ uses: ./.github/workflows/reusable_test_stage.yml
with:
- build_name: package_release_coverage
- checkout_depth: 0
+ stage: Tests_2
data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebAarch64:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
+ # stage for jobs that do not prohibit merge
+ Tests_3:
+ needs: [RunConfig, Builds_1]
+ if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_3') }}
+ uses: ./.github/workflows/reusable_test_stage.yml
with:
- build_name: package_aarch64
- checkout_depth: 0
+ stage: Tests_3
data: ${{ needs.RunConfig.outputs.data }}
- BuilderBinRelease:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_release
- checkout_depth: 0 # otherwise we will have no info about contributors
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebAsan:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: package_asan
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebUBsan:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: package_ubsan
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebTsan:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: package_tsan
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebMsan:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: package_msan
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderDebDebug:
- needs: [RunConfig, BuildDockers]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: package_debug
- data: ${{ needs.RunConfig.outputs.data }}
-##########################################################################################
-##################################### SPECIAL BUILDS #####################################
-##########################################################################################
- BuilderBinClangTidy:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_tidy
- data: ${{ needs.RunConfig.outputs.data }}
- BuilderBinDarwin:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_darwin
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinAarch64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinFreeBSD:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_freebsd
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinDarwinAarch64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_darwin_aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinPPC64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_ppc64le
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinAmd64Compat:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_amd64_compat
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinAmd64Musl:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_amd64_musl
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinAarch64V80Compat:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_aarch64_v80compat
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinRISCV64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_riscv64
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinS390X:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_s390x
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
- BuilderBinLoongarch64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_build.yml
- with:
- build_name: binary_loongarch64
- data: ${{ needs.RunConfig.outputs.data }}
- checkout_depth: 0
-############################################################################################
-##################################### Docker images #######################################
-############################################################################################
- DockerServerImage:
- needs: [RunConfig, BuilderDebRelease, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Docker server image
- runner_type: style-checker
- data: ${{ needs.RunConfig.outputs.data }}
- DockerKeeperImage:
- needs: [RunConfig, BuilderDebRelease, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Docker keeper image
- runner_type: style-checker
- data: ${{ needs.RunConfig.outputs.data }}
-############################################################################################
-##################################### BUILD REPORTER #######################################
-############################################################################################
- BuilderReport:
+
+ ################################# Reports #################################
+ # Reports should be run even if Builds_1/2 failed - put them separately in wf (not in Tests_1/2)
+ Builds_1_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderDebAarch64
- - BuilderDebAsan
- - BuilderDebDebug
- - BuilderDebMsan
- - BuilderDebRelease
- - BuilderDebTsan
- - BuilderDebUBsan
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse build check') }}
+ needs: [RunConfig, Builds_1]
uses: ./.github/workflows/reusable_test.yml
with:
test_name: ClickHouse build check
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
- BuilderSpecialReport:
+ Builds_2_Report:
# run report check for failed builds to indicate the CI error
- if: ${{ !cancelled() }}
- needs:
- - RunConfig
- - BuilderBinAarch64
- - BuilderBinDarwin
- - BuilderBinDarwinAarch64
- - BuilderBinFreeBSD
- - BuilderBinPPC64
- - BuilderBinRISCV64
- - BuilderBinS390X
- - BuilderBinLoongarch64
- - BuilderBinAmd64Compat
- - BuilderBinAarch64V80Compat
- - BuilderBinClangTidy
- - BuilderBinAmd64Musl
- - BuilderDebReleaseCoverage
- - BuilderBinRelease
+ if: ${{ !cancelled() && needs.RunConfig.result == 'success' && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'ClickHouse special build check') }}
+ needs: [RunConfig, Builds_2]
uses: ./.github/workflows/reusable_test.yml
with:
test_name: ClickHouse special build check
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
+
MarkReleaseReady:
if: ${{ !failure() && !cancelled() }}
- needs:
- - BuilderBinDarwin
- - BuilderBinDarwinAarch64
- - BuilderDebRelease
- - BuilderDebAarch64
- runs-on: [self-hosted, style-checker]
+ needs: [RunConfig, Builds_1, Builds_2]
+ runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Debug
run: |
@@ -338,7 +150,7 @@ jobs:
no both ${{ !(contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure')) }}
EOF
- name: Not ready
- # fail the job to be able restart it
+ # fail the job to be able to restart it
if: ${{ contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure') }}
run: exit 1
- name: Check out repository code
@@ -349,544 +161,14 @@ jobs:
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 mark_release_ready.py
-############################################################################################
-#################################### INSTALL PACKAGES ######################################
-############################################################################################
- InstallPackagesTestRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Install packages (amd64)
- runner_type: style-checker
- data: ${{ needs.RunConfig.outputs.data }}
- run_command: |
- python3 install_check.py "$CHECK_NAME"
- InstallPackagesTestAarch64:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Install packages (arm64)
- runner_type: style-checker-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- run_command: |
- python3 install_check.py "$CHECK_NAME"
-##############################################################################################
-########################### FUNCTIONAl STATELESS TESTS #######################################
-##############################################################################################
- FunctionalStatelessTestRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (release)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestReleaseAnalyzerS3Replicated:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (release, old analyzer, s3, DatabaseReplicated)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestS3Debug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (debug, s3 storage)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestS3Tsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (tsan, s3 storage)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestAarch64:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (aarch64)
- runner_type: func-tester-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (asan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (tsan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestMsan:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (msan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestUBsan:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (ubsan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestDebug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (debug)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatelessTestAsanAzure:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateless tests (azure, asan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-############################ FUNCTIONAl STATEFUL TESTS #######################################
-##############################################################################################
- FunctionalStatefulTestRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (release)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestAarch64:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (aarch64)
- runner_type: func-tester-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (asan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (tsan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestMsan:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (msan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestUBsan:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (ubsan)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestDebug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (debug)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- # Parallel replicas
- FunctionalStatefulTestDebugParallelReplicas:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (debug, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestUBsanParallelReplicas:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (ubsan, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestMsanParallelReplicas:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (msan, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestTsanParallelReplicas:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (tsan, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestAsanParallelReplicas:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (asan, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- FunctionalStatefulTestReleaseParallelReplicas:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stateful tests (release, ParallelReplicas)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-########################### ClickBench #######################################################
-##############################################################################################
- ClickBenchAMD64:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickBench (amd64)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
- run_command: |
- python3 clickbench.py "$CHECK_NAME"
- ClickBenchAarch64:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: ClickBench (aarch64)
- runner_type: func-tester-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
- run_command: |
- python3 clickbench.py "$CHECK_NAME"
-##############################################################################################
-######################################### STRESS TESTS #######################################
-##############################################################################################
- StressTestAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (asan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- StressTestTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (tsan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- StressTestTsanAzure:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (azure, tsan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- StressTestMsan:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (msan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- StressTestUBsan:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (ubsan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- StressTestDebug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Stress test (debug)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
-#############################################################################################
-############################# INTEGRATION TESTS #############################################
-#############################################################################################
- IntegrationTestsAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Integration tests (asan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- IntegrationTestsAnalyzerAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Integration tests (asan, old analyzer)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- IntegrationTestsTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Integration tests (tsan)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- IntegrationTestsRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Integration tests (release)
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-##################################### AST FUZZERS ############################################
-##############################################################################################
- ASTFuzzerTestAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: AST fuzzer (asan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- ASTFuzzerTestTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: AST fuzzer (tsan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- ASTFuzzerTestUBSan:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: AST fuzzer (ubsan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- ASTFuzzerTestMSan:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: AST fuzzer (msan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- ASTFuzzerTestDebug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: AST fuzzer (debug)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
-#############################################################################################
-#################################### UNIT TESTS #############################################
-#############################################################################################
- UnitTestsAsan:
- needs: [RunConfig, BuilderDebAsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Unit tests (asan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- UnitTestsReleaseClang:
- needs: [RunConfig, BuilderBinRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Unit tests (release)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- UnitTestsTsan:
- needs: [RunConfig, BuilderDebTsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Unit tests (tsan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- UnitTestsMsan:
- needs: [RunConfig, BuilderDebMsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Unit tests (msan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- UnitTestsUBsan:
- needs: [RunConfig, BuilderDebUBsan]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Unit tests (ubsan)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
-#############################################################################################
-#################################### PERFORMANCE TESTS ######################################
-#############################################################################################
- PerformanceComparisonX86:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Performance Comparison
- runner_type: stress-tester
- data: ${{ needs.RunConfig.outputs.data }}
- PerformanceComparisonAarch:
- needs: [RunConfig, BuilderDebAarch64]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Performance Comparison Aarch64
- runner_type: func-tester-aarch64
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-############################ SQLLOGIC TEST ###################################################
-##############################################################################################
- SQLLogicTestRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: Sqllogic test (release)
- runner_type: func-tester
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-##################################### SQL TEST ###############################################
-##############################################################################################
- SQLTest:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: SQLTest
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
-##############################################################################################
-###################################### SQLANCER FUZZERS ######################################
-##############################################################################################
- SQLancerTestRelease:
- needs: [RunConfig, BuilderDebRelease]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: SQLancer (release)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
- SQLancerTestDebug:
- needs: [RunConfig, BuilderDebDebug]
- if: ${{ !failure() && !cancelled() }}
- uses: ./.github/workflows/reusable_test.yml
- with:
- test_name: SQLancer (debug)
- runner_type: fuzzer-unit-tester
- data: ${{ needs.RunConfig.outputs.data }}
FinishCheck:
- if: ${{ !failure() && !cancelled() }}
- needs:
- - MarkReleaseReady
- - FunctionalStatelessTestDebug
- - FunctionalStatelessTestRelease
- - FunctionalStatelessTestReleaseAnalyzerS3Replicated
- - FunctionalStatelessTestAarch64
- - FunctionalStatelessTestAsan
- - FunctionalStatelessTestTsan
- - FunctionalStatelessTestMsan
- - FunctionalStatelessTestUBsan
- - FunctionalStatelessTestS3Debug
- - FunctionalStatelessTestS3Tsan
- - FunctionalStatefulTestDebug
- - FunctionalStatefulTestRelease
- - FunctionalStatefulTestAarch64
- - FunctionalStatefulTestAsan
- - FunctionalStatefulTestTsan
- - FunctionalStatefulTestMsan
- - FunctionalStatefulTestUBsan
- - FunctionalStatefulTestDebugParallelReplicas
- - FunctionalStatefulTestUBsanParallelReplicas
- - FunctionalStatefulTestMsanParallelReplicas
- - FunctionalStatefulTestTsanParallelReplicas
- - FunctionalStatefulTestAsanParallelReplicas
- - FunctionalStatefulTestReleaseParallelReplicas
- - StressTestDebug
- - StressTestAsan
- - StressTestTsan
- - StressTestMsan
- - StressTestUBsan
- - IntegrationTestsAsan
- - IntegrationTestsAnalyzerAsan
- - IntegrationTestsTsan
- - IntegrationTestsRelease
- - PerformanceComparisonX86
- - PerformanceComparisonAarch
- - CompatibilityCheckX86
- - CompatibilityCheckAarch64
- - ASTFuzzerTestDebug
- - ASTFuzzerTestAsan
- - ASTFuzzerTestTsan
- - ASTFuzzerTestMSan
- - ASTFuzzerTestUBSan
- - UnitTestsAsan
- - UnitTestsTsan
- - UnitTestsMsan
- - UnitTestsUBsan
- - UnitTestsReleaseClang
- - SQLancerTestRelease
- - SQLancerTestDebug
- - SQLLogicTestRelease
- - SQLTest
- runs-on: [self-hosted, style-checker]
+ if: ${{ !cancelled() }}
+ needs: [RunConfig, Builds_1, Builds_2, Builds_1_Report, Builds_2_Report, Tests_1, Tests_2, Tests_3]
+ runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Check out repository code
uses: ClickHouse/checkout@v1
- with:
- clear-repository: true
- name: Finish label
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
diff --git a/.github/workflows/merge_queue.yml b/.github/workflows/merge_queue.yml
index 1b6cc320ec4..d1b03198485 100644
--- a/.github/workflows/merge_queue.yml
+++ b/.github/workflows/merge_queue.yml
@@ -20,8 +20,11 @@ jobs:
uses: ClickHouse/checkout@v1
with:
clear-repository: true # to ensure correct digests
- fetch-depth: 0 # to get version
+ fetch-depth: 0 # to get a version
filter: tree:0
+ - name: Cancel PR workflow
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --cancel-previous-run
- name: Python unit tests
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
@@ -57,7 +60,7 @@ jobs:
uses: ./.github/workflows/reusable_test.yml
with:
test_name: Style check
- runner_type: style-checker
+ runner_type: style-checker-aarch64
run_command: |
python3 style_check.py
data: ${{ needs.RunConfig.outputs.data }}
@@ -82,7 +85,7 @@ jobs:
FinishCheck:
if: ${{ !failure() && !cancelled() }}
needs: [RunConfig, BuildDockers, StyleCheck, FastTest]
- runs-on: [self-hosted, style-checker]
+ runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Check out repository code
uses: ClickHouse/checkout@v1
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index f20e987db97..7d22554473e 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -31,8 +31,14 @@ jobs:
uses: ClickHouse/checkout@v1
with:
clear-repository: true # to ensure correct digests
- fetch-depth: 0 # to get version
+ fetch-depth: 0 # to get a version
filter: tree:0
+ - name: Cancel previous Sync PR workflow
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --cancel-previous-run
+ - name: Set pending Sync status
+ run: |
+ python3 "$GITHUB_WORKSPACE/tests/ci/ci.py" --set-pending-status
- name: Labels check
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
@@ -75,7 +81,7 @@ jobs:
uses: ./.github/workflows/reusable_test.yml
with:
test_name: Style check
- runner_type: style-checker
+ runner_type: style-checker-aarch64
run_command: |
python3 style_check.py
data: ${{ needs.RunConfig.outputs.data }}
@@ -95,13 +101,13 @@ jobs:
run_command: |
python3 fast_test_check.py
- ################################# Main statges #################################
+ ################################# Main stages #################################
# for main CI chain
#
Builds_1:
needs: [RunConfig, StyleCheck, FastTest]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }}
- # using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
+ # using callable wf (reusable_stage.yml) allows grouping all nested jobs under a tab
uses: ./.github/workflows/reusable_build_stage.yml
with:
stage: Builds_1
@@ -109,7 +115,6 @@ jobs:
Tests_1:
needs: [RunConfig, Builds_1]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_1') }}
- # using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
uses: ./.github/workflows/reusable_test_stage.yml
with:
stage: Tests_1
@@ -117,7 +122,6 @@ jobs:
Builds_2:
needs: [RunConfig, Builds_1]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_2') }}
- # using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
uses: ./.github/workflows/reusable_build_stage.yml
with:
stage: Builds_2
@@ -125,7 +129,6 @@ jobs:
Tests_2:
needs: [RunConfig, Builds_2]
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }}
- # using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
uses: ./.github/workflows/reusable_test_stage.yml
with:
stage: Tests_2
@@ -177,9 +180,9 @@ jobs:
################################# Stage Final #################################
#
FinishCheck:
- if: ${{ !failure() && !cancelled() }}
+ if: ${{ !cancelled() }}
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2, Builds_1_Report, Builds_2_Report, Tests_1, Tests_2, Tests_3]
- runs-on: [self-hosted, style-checker]
+ runs-on: [self-hosted, style-checker-aarch64]
steps:
- name: Check out repository code
uses: ClickHouse/checkout@v1
@@ -189,13 +192,6 @@ jobs:
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 finish_check.py
- # FIXME: merge on approval does not work with MQ. Could be fixed by using defaul GH's automerge after some corrections in Mergeable Check status
- # - name: Auto merge if approved
- # if: ${{ github.event_name != 'merge_group' }}
- # run: |
- # cd "$GITHUB_WORKSPACE/tests/ci"
- # python3 merge_pr.py --check-approved
-
#############################################################################################
###################################### JEPSEN TESTS #########################################
@@ -213,5 +209,5 @@ jobs:
uses: ./.github/workflows/reusable_test.yml
with:
test_name: ClickHouse Keeper Jepsen
- runner_type: style-checker
+ runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
diff --git a/.github/workflows/reusable_build.yml b/.github/workflows/reusable_build.yml
index 80d78d93e1b..5e254d785ec 100644
--- a/.github/workflows/reusable_build.yml
+++ b/.github/workflows/reusable_build.yml
@@ -33,6 +33,10 @@ name: Build ClickHouse
additional_envs:
description: additional ENV variables to setup the job
type: string
+ secrets:
+ secret_envs:
+ description: if given, it's passed to the environments
+ required: false
jobs:
Build:
@@ -54,6 +58,7 @@ jobs:
run: |
cat >> "$GITHUB_ENV" << 'EOF'
${{inputs.additional_envs}}
+ ${{secrets.secret_envs}}
DOCKER_TAG<
- inline T allocateObjectForBorrowing(const std::unique_lock &, FactoryFunc && func)
+ T allocateObjectForBorrowing(const std::unique_lock &, FactoryFunc && func)
{
++allocated_objects_size;
++borrowed_objects_size;
@@ -137,7 +137,7 @@ private:
return std::forward(func)();
}
- inline T borrowFromObjects(const std::unique_lock &)
+ T borrowFromObjects(const std::unique_lock &)
{
T dst;
detail::moveOrCopyIfThrow(std::move(objects.back()), dst);
diff --git a/base/base/Decimal_fwd.h b/base/base/Decimal_fwd.h
index beb228cea3c..a11e13a479b 100644
--- a/base/base/Decimal_fwd.h
+++ b/base/base/Decimal_fwd.h
@@ -44,6 +44,10 @@ concept is_over_big_int =
|| std::is_same_v
|| std::is_same_v
|| std::is_same_v;
+
+template
+concept is_over_big_decimal = is_decimal && is_over_big_int;
+
}
template <> struct is_signed { static constexpr bool value = true; };
diff --git a/cmake/autogenerated_versions.txt b/cmake/autogenerated_versions.txt
index f8ff71876c6..dfbbb66a1e9 100644
--- a/cmake/autogenerated_versions.txt
+++ b/cmake/autogenerated_versions.txt
@@ -2,11 +2,11 @@
# NOTE: has nothing common with DBMS_TCP_PROTOCOL_VERSION,
# only DBMS_TCP_PROTOCOL_VERSION should be incremented on protocol changes.
-SET(VERSION_REVISION 54486)
+SET(VERSION_REVISION 54487)
SET(VERSION_MAJOR 24)
-SET(VERSION_MINOR 5)
+SET(VERSION_MINOR 6)
SET(VERSION_PATCH 1)
-SET(VERSION_GITHASH 6d4b31322d168356c8b10c43b4cef157c82337ff)
-SET(VERSION_DESCRIBE v24.5.1.1-testing)
-SET(VERSION_STRING 24.5.1.1)
+SET(VERSION_GITHASH 70a1d3a63d47f0be077d67b8deb907230fc7cfb0)
+SET(VERSION_DESCRIBE v24.6.1.1-testing)
+SET(VERSION_STRING 24.6.1.1)
# end of autochange
diff --git a/contrib/arrow b/contrib/arrow
index 8f36d71d185..5cfccd8ea65 160000
--- a/contrib/arrow
+++ b/contrib/arrow
@@ -1 +1 @@
-Subproject commit 8f36d71d18587f1f315ec832f424183cb6519cbb
+Subproject commit 5cfccd8ea65f33d4517e7409815d761c7650b45d
diff --git a/contrib/aws b/contrib/aws
index 2e12d7c6daf..eb96e740453 160000
--- a/contrib/aws
+++ b/contrib/aws
@@ -1 +1 @@
-Subproject commit 2e12d7c6dafa81311ee3d73ac6a178550ffa75be
+Subproject commit eb96e740453ae27afa1f367ba19f99bdcb38484d
diff --git a/docker/test/style/Dockerfile b/docker/test/style/Dockerfile
index 5d53d03606f..172fbce6406 100644
--- a/docker/test/style/Dockerfile
+++ b/docker/test/style/Dockerfile
@@ -11,6 +11,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \
aspell \
curl \
git \
+ gh \
file \
libxml2-utils \
moreutils \
diff --git a/docs/_description_templates/template-setting.md b/docs/_description_templates/template-setting.md
index fc912aba3e1..f4525d872df 100644
--- a/docs/_description_templates/template-setting.md
+++ b/docs/_description_templates/template-setting.md
@@ -2,7 +2,7 @@
Description.
-For the switch setting, use the typical phrase: “Enables or disables something …”.
+For the switch setting, use the typical phrase: “Enables or disables something ...”.
Possible values:
diff --git a/docs/changelogs/v20.7.1.4310-prestable.md b/docs/changelogs/v20.7.1.4310-prestable.md
index f47c7334228..aa1d993b263 100644
--- a/docs/changelogs/v20.7.1.4310-prestable.md
+++ b/docs/changelogs/v20.7.1.4310-prestable.md
@@ -166,4 +166,4 @@
* NO CL ENTRY: 'Revert "Abort on std::out_of_range in debug builds"'. [#12752](https://github.com/ClickHouse/ClickHouse/pull/12752) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* NO CL ENTRY: 'Bump protobuf from 3.12.2 to 3.12.4 in /docs/tools'. [#13102](https://github.com/ClickHouse/ClickHouse/pull/13102) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)).
* NO CL ENTRY: 'Merge [#12574](https://github.com/ClickHouse/ClickHouse/issues/12574)'. [#13158](https://github.com/ClickHouse/ClickHouse/pull/13158) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
-* NO CL ENTRY: 'Revert "Add QueryTimeMicroseconds, SelectQueryTimeMicroseconds and InsertQuer…"'. [#13303](https://github.com/ClickHouse/ClickHouse/pull/13303) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
+* NO CL ENTRY: 'Revert "Add QueryTimeMicroseconds, SelectQueryTimeMicroseconds and InsertQuer..."'. [#13303](https://github.com/ClickHouse/ClickHouse/pull/13303) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
diff --git a/docs/changelogs/v21.12.1.9017-prestable.md b/docs/changelogs/v21.12.1.9017-prestable.md
index 88b8260e312..bd84873e67a 100644
--- a/docs/changelogs/v21.12.1.9017-prestable.md
+++ b/docs/changelogs/v21.12.1.9017-prestable.md
@@ -421,5 +421,5 @@ sidebar_label: 2022
* Fix possible crash in DataTypeAggregateFunction [#32287](https://github.com/ClickHouse/ClickHouse/pull/32287) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
* Update backport.py [#32323](https://github.com/ClickHouse/ClickHouse/pull/32323) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Fix graphite-bench build [#32351](https://github.com/ClickHouse/ClickHouse/pull/32351) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
-* Revert "graphite: split tagged/plain rollup rules (for merges perfoma… [#32376](https://github.com/ClickHouse/ClickHouse/pull/32376) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
+* Revert "graphite: split tagged/plain rollup rules (for merges perfoma... [#32376](https://github.com/ClickHouse/ClickHouse/pull/32376) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
* Another attempt to fix unit test Executor::RemoveTasksStress [#32390](https://github.com/ClickHouse/ClickHouse/pull/32390) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
diff --git a/docs/changelogs/v21.3.3.14-lts.md b/docs/changelogs/v21.3.3.14-lts.md
index 57bde602f21..91d99deaa6b 100644
--- a/docs/changelogs/v21.3.3.14-lts.md
+++ b/docs/changelogs/v21.3.3.14-lts.md
@@ -18,4 +18,4 @@ sidebar_label: 2022
#### NOT FOR CHANGELOG / INSIGNIFICANT
-* fix incorrect number of rows for Chunks with no columns in PartialSor… [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
+* fix incorrect number of rows for Chunks with no columns in PartialSor... [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
diff --git a/docs/changelogs/v21.4.1.6422-prestable.md b/docs/changelogs/v21.4.1.6422-prestable.md
index 2eadb0d4754..66937c3be15 100644
--- a/docs/changelogs/v21.4.1.6422-prestable.md
+++ b/docs/changelogs/v21.4.1.6422-prestable.md
@@ -223,7 +223,7 @@ sidebar_label: 2022
* Do not overlap zookeeper path for ReplicatedMergeTree in stateless *.sh tests [#21724](https://github.com/ClickHouse/ClickHouse/pull/21724) ([Azat Khuzhin](https://github.com/azat)).
* make the fuzzer use sources from the CI [#21754](https://github.com/ClickHouse/ClickHouse/pull/21754) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* Add one more variant to memcpy benchmark [#21759](https://github.com/ClickHouse/ClickHouse/pull/21759) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
-* fix incorrect number of rows for Chunks with no columns in PartialSor… [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
+* fix incorrect number of rows for Chunks with no columns in PartialSor... [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* docs(fix): typo [#21775](https://github.com/ClickHouse/ClickHouse/pull/21775) ([Ali Demirci](https://github.com/depyronick)).
* DDLWorker.cpp: fixed exceeded amount of tries typo [#21807](https://github.com/ClickHouse/ClickHouse/pull/21807) ([Eldar Nasyrov](https://github.com/3ldar-nasyrov)).
* fix integration MaterializeMySQL test [#21819](https://github.com/ClickHouse/ClickHouse/pull/21819) ([TCeason](https://github.com/TCeason)).
diff --git a/docs/changelogs/v21.4.2.10-prestable.md b/docs/changelogs/v21.4.2.10-prestable.md
index 3db17ddfcf3..b9bdbd80c0c 100644
--- a/docs/changelogs/v21.4.2.10-prestable.md
+++ b/docs/changelogs/v21.4.2.10-prestable.md
@@ -226,7 +226,7 @@ sidebar_label: 2022
* Do not overlap zookeeper path for ReplicatedMergeTree in stateless *.sh tests [#21724](https://github.com/ClickHouse/ClickHouse/pull/21724) ([Azat Khuzhin](https://github.com/azat)).
* make the fuzzer use sources from the CI [#21754](https://github.com/ClickHouse/ClickHouse/pull/21754) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* Add one more variant to memcpy benchmark [#21759](https://github.com/ClickHouse/ClickHouse/pull/21759) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
-* fix incorrect number of rows for Chunks with no columns in PartialSor… [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
+* fix incorrect number of rows for Chunks with no columns in PartialSor... [#21761](https://github.com/ClickHouse/ClickHouse/pull/21761) ([Alexander Kuzmenkov](https://github.com/akuzm)).
* docs(fix): typo [#21775](https://github.com/ClickHouse/ClickHouse/pull/21775) ([Ali Demirci](https://github.com/depyronick)).
* DDLWorker.cpp: fixed exceeded amount of tries typo [#21807](https://github.com/ClickHouse/ClickHouse/pull/21807) ([Eldar Nasyrov](https://github.com/3ldar-nasyrov)).
* fix integration MaterializeMySQL test [#21819](https://github.com/ClickHouse/ClickHouse/pull/21819) ([TCeason](https://github.com/TCeason)).
diff --git a/docs/changelogs/v22.6.1.1985-stable.md b/docs/changelogs/v22.6.1.1985-stable.md
index c915d24fe00..7bd7038377a 100644
--- a/docs/changelogs/v22.6.1.1985-stable.md
+++ b/docs/changelogs/v22.6.1.1985-stable.md
@@ -160,7 +160,7 @@ sidebar_label: 2022
* fix toString error on DatatypeDate32. [#37775](https://github.com/ClickHouse/ClickHouse/pull/37775) ([LiuNeng](https://github.com/liuneng1994)).
* The clickhouse-keeper setting `dead_session_check_period_ms` was transformed into microseconds (multiplied by 1000), which lead to dead sessions only being cleaned up after several minutes (instead of 500ms). [#37824](https://github.com/ClickHouse/ClickHouse/pull/37824) ([Michael Lex](https://github.com/mlex)).
* Fix possible "No more packets are available" for distributed queries (in case of `async_socket_for_remote`/`use_hedged_requests` is disabled). [#37826](https://github.com/ClickHouse/ClickHouse/pull/37826) ([Azat Khuzhin](https://github.com/azat)).
-* Do not drop the inner target table when executing `ALTER TABLE … MODIFY QUERY` in WindowView. [#37879](https://github.com/ClickHouse/ClickHouse/pull/37879) ([vxider](https://github.com/Vxider)).
+* Do not drop the inner target table when executing `ALTER TABLE ... MODIFY QUERY` in WindowView. [#37879](https://github.com/ClickHouse/ClickHouse/pull/37879) ([vxider](https://github.com/Vxider)).
* Fix directory ownership of coordination dir in clickhouse-keeper Docker image. Fixes [#37914](https://github.com/ClickHouse/ClickHouse/issues/37914). [#37915](https://github.com/ClickHouse/ClickHouse/pull/37915) ([James Maidment](https://github.com/jamesmaidment)).
* Dictionaries fix custom query with update field and `{condition}`. Closes [#33746](https://github.com/ClickHouse/ClickHouse/issues/33746). [#37947](https://github.com/ClickHouse/ClickHouse/pull/37947) ([Maksim Kita](https://github.com/kitaisreal)).
* Fix possible incorrect result of `SELECT ... WITH FILL` in the case when `ORDER BY` should be applied after `WITH FILL` result (e.g. for outer query). Incorrect result was caused by optimization for `ORDER BY` expressions ([#35623](https://github.com/ClickHouse/ClickHouse/issues/35623)). Closes [#37904](https://github.com/ClickHouse/ClickHouse/issues/37904). [#37959](https://github.com/ClickHouse/ClickHouse/pull/37959) ([Yakov Olkhovskiy](https://github.com/yakov-olkhovskiy)).
@@ -180,7 +180,7 @@ sidebar_label: 2022
#### NO CL ENTRY
* NO CL ENTRY: 'Revert "Fix mutations in tables with columns of type `Object`"'. [#37355](https://github.com/ClickHouse/ClickHouse/pull/37355) ([Alexander Tokmakov](https://github.com/tavplubix)).
-* NO CL ENTRY: 'Revert "Remove height restrictions from the query div in play web tool, and m…"'. [#37501](https://github.com/ClickHouse/ClickHouse/pull/37501) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
+* NO CL ENTRY: 'Revert "Remove height restrictions from the query div in play web tool, and m..."'. [#37501](https://github.com/ClickHouse/ClickHouse/pull/37501) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* NO CL ENTRY: 'Revert "Add support for preprocessing ZooKeeper operations in `clickhouse-keeper`"'. [#37534](https://github.com/ClickHouse/ClickHouse/pull/37534) ([Antonio Andelic](https://github.com/antonio2368)).
* NO CL ENTRY: 'Revert "(only with zero-copy replication, non-production experimental feature not recommended to use) fix possible deadlock during fetching part"'. [#37545](https://github.com/ClickHouse/ClickHouse/pull/37545) ([Alexander Tokmakov](https://github.com/tavplubix)).
* NO CL ENTRY: 'Revert "RFC: Fix converting types for UNION queries (may produce LOGICAL_ERROR)"'. [#37582](https://github.com/ClickHouse/ClickHouse/pull/37582) ([Dmitry Novik](https://github.com/novikd)).
diff --git a/docs/changelogs/v22.7.1.2484-stable.md b/docs/changelogs/v22.7.1.2484-stable.md
index 7464b0449ee..c4a76c66e0c 100644
--- a/docs/changelogs/v22.7.1.2484-stable.md
+++ b/docs/changelogs/v22.7.1.2484-stable.md
@@ -410,7 +410,7 @@ sidebar_label: 2022
* Add test for [#39132](https://github.com/ClickHouse/ClickHouse/issues/39132) [#39173](https://github.com/ClickHouse/ClickHouse/pull/39173) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* Suppression for BC check (`Cannot parse string 'Hello' as UInt64`) [#39176](https://github.com/ClickHouse/ClickHouse/pull/39176) ([Alexander Tokmakov](https://github.com/tavplubix)).
* Fix 01961_roaring_memory_tracking test [#39187](https://github.com/ClickHouse/ClickHouse/pull/39187) ([Dmitry Novik](https://github.com/novikd)).
-* Cleanup: done during [#38719](https://github.com/ClickHouse/ClickHouse/issues/38719) (SortingStep: deduce way to sort based on … [#39191](https://github.com/ClickHouse/ClickHouse/pull/39191) ([Igor Nikonov](https://github.com/devcrafter)).
+* Cleanup: done during [#38719](https://github.com/ClickHouse/ClickHouse/issues/38719) (SortingStep: deduce way to sort based on ... [#39191](https://github.com/ClickHouse/ClickHouse/pull/39191) ([Igor Nikonov](https://github.com/devcrafter)).
* Fix exception in AsynchronousMetrics for s390x [#39193](https://github.com/ClickHouse/ClickHouse/pull/39193) ([Harry Lee](https://github.com/HarryLeeIBM)).
* Optimize accesses to system.stack_trace (filter by name before sending signal) [#39212](https://github.com/ClickHouse/ClickHouse/pull/39212) ([Azat Khuzhin](https://github.com/azat)).
* Enable warning "-Wdeprecated-dynamic-exception-spec" [#39213](https://github.com/ClickHouse/ClickHouse/pull/39213) ([Robert Schulze](https://github.com/rschu1ze)).
diff --git a/docs/changelogs/v22.8.13.20-lts.md b/docs/changelogs/v22.8.13.20-lts.md
index 0734f40bf3e..ad44fbfc5d6 100644
--- a/docs/changelogs/v22.8.13.20-lts.md
+++ b/docs/changelogs/v22.8.13.20-lts.md
@@ -20,4 +20,4 @@ sidebar_label: 2023
* Fix wrong approved_at, simplify conditions [#45302](https://github.com/ClickHouse/ClickHouse/pull/45302) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
* Get rid of artifactory in favor of r2 + ch-repos-manager [#45421](https://github.com/ClickHouse/ClickHouse/pull/45421) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
* Trim refs/tags/ from GITHUB_TAG in release workflow [#45636](https://github.com/ClickHouse/ClickHouse/pull/45636) ([Mikhail f. Shiryaev](https://github.com/Felixoid)).
-* Merge pull request [#38262](https://github.com/ClickHouse/ClickHouse/issues/38262) from PolyProgrammist/fix-ordinary-system-un… [#45650](https://github.com/ClickHouse/ClickHouse/pull/45650) ([alesapin](https://github.com/alesapin)).
+* Merge pull request [#38262](https://github.com/ClickHouse/ClickHouse/issues/38262) from PolyProgrammist/fix-ordinary-system-un... [#45650](https://github.com/ClickHouse/ClickHouse/pull/45650) ([alesapin](https://github.com/alesapin)).
diff --git a/docs/changelogs/v23.11.1.2711-stable.md b/docs/changelogs/v23.11.1.2711-stable.md
index e32dee41dc7..0bdee08f5c9 100644
--- a/docs/changelogs/v23.11.1.2711-stable.md
+++ b/docs/changelogs/v23.11.1.2711-stable.md
@@ -217,7 +217,7 @@ sidebar_label: 2023
* S3Queue minor fix [#56999](https://github.com/ClickHouse/ClickHouse/pull/56999) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Fix file path validation for DatabaseFileSystem [#57029](https://github.com/ClickHouse/ClickHouse/pull/57029) ([San](https://github.com/santrancisco)).
* Fix `fuzzBits` with `ARRAY JOIN` [#57033](https://github.com/ClickHouse/ClickHouse/pull/57033) ([Antonio Andelic](https://github.com/antonio2368)).
-* Fix Nullptr dereference in partial merge join with joined_subquery_re… [#57048](https://github.com/ClickHouse/ClickHouse/pull/57048) ([vdimir](https://github.com/vdimir)).
+* Fix Nullptr dereference in partial merge join with joined_subquery_re... [#57048](https://github.com/ClickHouse/ClickHouse/pull/57048) ([vdimir](https://github.com/vdimir)).
* Fix race condition in RemoteSource [#57052](https://github.com/ClickHouse/ClickHouse/pull/57052) ([Raúl Marín](https://github.com/Algunenano)).
* Implement `bitHammingDistance` for big integers [#57073](https://github.com/ClickHouse/ClickHouse/pull/57073) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* S3-style links bug fix [#57075](https://github.com/ClickHouse/ClickHouse/pull/57075) ([Yarik Briukhovetskyi](https://github.com/yariks5s)).
diff --git a/docs/changelogs/v23.12.1.1368-stable.md b/docs/changelogs/v23.12.1.1368-stable.md
index 1a322ae9c0f..cb8ba57100e 100644
--- a/docs/changelogs/v23.12.1.1368-stable.md
+++ b/docs/changelogs/v23.12.1.1368-stable.md
@@ -272,7 +272,7 @@ sidebar_label: 2023
* Bump Azure to v1.6.0 [#58052](https://github.com/ClickHouse/ClickHouse/pull/58052) ([Robert Schulze](https://github.com/rschu1ze)).
* Correct values for randomization [#58058](https://github.com/ClickHouse/ClickHouse/pull/58058) ([Anton Popov](https://github.com/CurtizJ)).
* Non post request should be readonly [#58060](https://github.com/ClickHouse/ClickHouse/pull/58060) ([San](https://github.com/santrancisco)).
-* Revert "Merge pull request [#55710](https://github.com/ClickHouse/ClickHouse/issues/55710) from guoxiaolongzte/clickhouse-test… [#58066](https://github.com/ClickHouse/ClickHouse/pull/58066) ([Raúl Marín](https://github.com/Algunenano)).
+* Revert "Merge pull request [#55710](https://github.com/ClickHouse/ClickHouse/issues/55710) from guoxiaolongzte/clickhouse-test... [#58066](https://github.com/ClickHouse/ClickHouse/pull/58066) ([Raúl Marín](https://github.com/Algunenano)).
* fix typo in the test 02479 [#58072](https://github.com/ClickHouse/ClickHouse/pull/58072) ([Sema Checherinda](https://github.com/CheSema)).
* Bump Azure to 1.7.2 [#58075](https://github.com/ClickHouse/ClickHouse/pull/58075) ([Robert Schulze](https://github.com/rschu1ze)).
* Fix flaky test `02567_and_consistency` [#58076](https://github.com/ClickHouse/ClickHouse/pull/58076) ([Anton Popov](https://github.com/CurtizJ)).
diff --git a/docs/changelogs/v23.3.1.2823-lts.md b/docs/changelogs/v23.3.1.2823-lts.md
index 0c9be3601da..f81aba53ebe 100644
--- a/docs/changelogs/v23.3.1.2823-lts.md
+++ b/docs/changelogs/v23.3.1.2823-lts.md
@@ -520,7 +520,7 @@ sidebar_label: 2023
* Improve script for updating clickhouse-docs [#48135](https://github.com/ClickHouse/ClickHouse/pull/48135) ([Alexander Tokmakov](https://github.com/tavplubix)).
* Fix stdlib compatibility issues [#48150](https://github.com/ClickHouse/ClickHouse/pull/48150) ([DimasKovas](https://github.com/DimasKovas)).
* Make test test_disallow_concurrency less flaky [#48152](https://github.com/ClickHouse/ClickHouse/pull/48152) ([Vitaly Baranov](https://github.com/vitlibar)).
-* Remove unused mockSystemDatabase from gtest_transform_query_for_exter… [#48162](https://github.com/ClickHouse/ClickHouse/pull/48162) ([Vladimir C](https://github.com/vdimir)).
+* Remove unused mockSystemDatabase from gtest_transform_query_for_exter... [#48162](https://github.com/ClickHouse/ClickHouse/pull/48162) ([Vladimir C](https://github.com/vdimir)).
* Update environmental-sensors.md [#48166](https://github.com/ClickHouse/ClickHouse/pull/48166) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* Correctly handle NULL constants in logical optimizer for new analyzer [#48168](https://github.com/ClickHouse/ClickHouse/pull/48168) ([Antonio Andelic](https://github.com/antonio2368)).
* Try making KeeperMap test more stable [#48170](https://github.com/ClickHouse/ClickHouse/pull/48170) ([Antonio Andelic](https://github.com/antonio2368)).
diff --git a/docs/changelogs/v23.5.1.3174-stable.md b/docs/changelogs/v23.5.1.3174-stable.md
index 2212eb6e893..4bdd4139afc 100644
--- a/docs/changelogs/v23.5.1.3174-stable.md
+++ b/docs/changelogs/v23.5.1.3174-stable.md
@@ -474,7 +474,7 @@ sidebar_label: 2023
* Fix flakiness of test_distributed_load_balancing test [#49921](https://github.com/ClickHouse/ClickHouse/pull/49921) ([Azat Khuzhin](https://github.com/azat)).
* Add some logging [#49925](https://github.com/ClickHouse/ClickHouse/pull/49925) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Support hardlinking parts transactionally [#49931](https://github.com/ClickHouse/ClickHouse/pull/49931) ([Michael Kolupaev](https://github.com/al13n321)).
-* Fix for analyzer: 02377_ optimize_sorting_by_input_stream_properties_e… [#49943](https://github.com/ClickHouse/ClickHouse/pull/49943) ([Igor Nikonov](https://github.com/devcrafter)).
+* Fix for analyzer: 02377_ optimize_sorting_by_input_stream_properties_e... [#49943](https://github.com/ClickHouse/ClickHouse/pull/49943) ([Igor Nikonov](https://github.com/devcrafter)).
* Follow up to [#49429](https://github.com/ClickHouse/ClickHouse/issues/49429) [#49964](https://github.com/ClickHouse/ClickHouse/pull/49964) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Fix flaky test_ssl_cert_authentication to use urllib3 [#49982](https://github.com/ClickHouse/ClickHouse/pull/49982) ([SmitaRKulkarni](https://github.com/SmitaRKulkarni)).
* Fix woboq codebrowser build with -Wno-poison-system-directories [#49992](https://github.com/ClickHouse/ClickHouse/pull/49992) ([Azat Khuzhin](https://github.com/azat)).
diff --git a/docs/changelogs/v23.8.1.2992-lts.md b/docs/changelogs/v23.8.1.2992-lts.md
index 7c224b19350..05385d9c52b 100644
--- a/docs/changelogs/v23.8.1.2992-lts.md
+++ b/docs/changelogs/v23.8.1.2992-lts.md
@@ -272,7 +272,7 @@ sidebar_label: 2023
* Add more checks into ThreadStatus ctor. [#42019](https://github.com/ClickHouse/ClickHouse/pull/42019) ([Nikolai Kochetov](https://github.com/KochetovNicolai)).
* Refactor Query Tree visitor [#46740](https://github.com/ClickHouse/ClickHouse/pull/46740) ([Dmitry Novik](https://github.com/novikd)).
* Revert "Revert "Randomize JIT settings in tests"" [#48282](https://github.com/ClickHouse/ClickHouse/pull/48282) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
-* Fix outdated cache configuration in s3 tests: s3_storage_policy_by_defau… [#48424](https://github.com/ClickHouse/ClickHouse/pull/48424) ([Kseniia Sumarokova](https://github.com/kssenii)).
+* Fix outdated cache configuration in s3 tests: s3_storage_policy_by_defau... [#48424](https://github.com/ClickHouse/ClickHouse/pull/48424) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Fix IN with decimal in analyzer [#48754](https://github.com/ClickHouse/ClickHouse/pull/48754) ([vdimir](https://github.com/vdimir)).
* Some unclear change in StorageBuffer::reschedule() for something [#49723](https://github.com/ClickHouse/ClickHouse/pull/49723) ([DimasKovas](https://github.com/DimasKovas)).
* MergeTree & SipHash checksum big-endian support [#50276](https://github.com/ClickHouse/ClickHouse/pull/50276) ([ltrk2](https://github.com/ltrk2)).
diff --git a/docs/changelogs/v24.1.3.31-stable.md b/docs/changelogs/v24.1.3.31-stable.md
index 046ca451fbc..e898fba5c87 100644
--- a/docs/changelogs/v24.1.3.31-stable.md
+++ b/docs/changelogs/v24.1.3.31-stable.md
@@ -13,7 +13,7 @@ sidebar_label: 2024
#### Bug Fix (user-visible misbehavior in an official stable release)
-* Fix `ASTAlterCommand::formatImpl` in case of column specific settings… [#59445](https://github.com/ClickHouse/ClickHouse/pull/59445) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
+* Fix `ASTAlterCommand::formatImpl` in case of column specific settings... [#59445](https://github.com/ClickHouse/ClickHouse/pull/59445) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
* Make MAX use the same rules as permutation for complex types [#59498](https://github.com/ClickHouse/ClickHouse/pull/59498) ([Raúl Marín](https://github.com/Algunenano)).
* Fix corner case when passing `update_insert_deduplication_token_in_dependent_materialized_views` [#59544](https://github.com/ClickHouse/ClickHouse/pull/59544) ([Jordi Villar](https://github.com/jrdi)).
* Fix incorrect result of arrayElement / map[] on empty value [#59594](https://github.com/ClickHouse/ClickHouse/pull/59594) ([Raúl Marín](https://github.com/Algunenano)).
diff --git a/docs/changelogs/v24.2.1.2248-stable.md b/docs/changelogs/v24.2.1.2248-stable.md
index 6113dd51ab1..02affe12c43 100644
--- a/docs/changelogs/v24.2.1.2248-stable.md
+++ b/docs/changelogs/v24.2.1.2248-stable.md
@@ -130,7 +130,7 @@ sidebar_label: 2024
* Fix translate() with FixedString input [#59356](https://github.com/ClickHouse/ClickHouse/pull/59356) ([Raúl Marín](https://github.com/Algunenano)).
* Fix digest calculation in Keeper [#59439](https://github.com/ClickHouse/ClickHouse/pull/59439) ([Antonio Andelic](https://github.com/antonio2368)).
* Fix stacktraces for binaries without debug symbols [#59444](https://github.com/ClickHouse/ClickHouse/pull/59444) ([Azat Khuzhin](https://github.com/azat)).
-* Fix `ASTAlterCommand::formatImpl` in case of column specific settings… [#59445](https://github.com/ClickHouse/ClickHouse/pull/59445) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
+* Fix `ASTAlterCommand::formatImpl` in case of column specific settings... [#59445](https://github.com/ClickHouse/ClickHouse/pull/59445) ([János Benjamin Antal](https://github.com/antaljanosbenjamin)).
* Fix `SELECT * FROM [...] ORDER BY ALL` with Analyzer [#59462](https://github.com/ClickHouse/ClickHouse/pull/59462) ([zhongyuankai](https://github.com/zhongyuankai)).
* Fix possible uncaught exception during distributed query cancellation [#59487](https://github.com/ClickHouse/ClickHouse/pull/59487) ([Azat Khuzhin](https://github.com/azat)).
* Make MAX use the same rules as permutation for complex types [#59498](https://github.com/ClickHouse/ClickHouse/pull/59498) ([Raúl Marín](https://github.com/Algunenano)).
diff --git a/docs/changelogs/v24.3.1.2672-lts.md b/docs/changelogs/v24.3.1.2672-lts.md
index e5d008680a8..006ab941203 100644
--- a/docs/changelogs/v24.3.1.2672-lts.md
+++ b/docs/changelogs/v24.3.1.2672-lts.md
@@ -526,7 +526,7 @@ sidebar_label: 2024
* No "please" [#61916](https://github.com/ClickHouse/ClickHouse/pull/61916) ([Alexey Milovidov](https://github.com/alexey-milovidov)).
* Update version_date.tsv and changelogs after v23.12.6.19-stable [#61917](https://github.com/ClickHouse/ClickHouse/pull/61917) ([robot-clickhouse](https://github.com/robot-clickhouse)).
* Update version_date.tsv and changelogs after v24.1.8.22-stable [#61918](https://github.com/ClickHouse/ClickHouse/pull/61918) ([robot-clickhouse](https://github.com/robot-clickhouse)).
-* Fix flaky test_broken_projestions/test.py::test_broken_ignored_replic… [#61932](https://github.com/ClickHouse/ClickHouse/pull/61932) ([Kseniia Sumarokova](https://github.com/kssenii)).
+* Fix flaky test_broken_projestions/test.py::test_broken_ignored_replic... [#61932](https://github.com/ClickHouse/ClickHouse/pull/61932) ([Kseniia Sumarokova](https://github.com/kssenii)).
* Check is Rust avaiable for build, if not, suggest a way to disable Rust support [#61938](https://github.com/ClickHouse/ClickHouse/pull/61938) ([Azat Khuzhin](https://github.com/azat)).
* CI: new ci menu in PR body [#61948](https://github.com/ClickHouse/ClickHouse/pull/61948) ([Max K.](https://github.com/maxknv)).
* Remove flaky test `01193_metadata_loading` [#61961](https://github.com/ClickHouse/ClickHouse/pull/61961) ([Nikita Taranov](https://github.com/nickitat)).
diff --git a/docs/en/development/style.md b/docs/en/development/style.md
index d201bbb0d3c..0f097d27607 100644
--- a/docs/en/development/style.md
+++ b/docs/en/development/style.md
@@ -57,7 +57,7 @@ memcpy(&buf[place_value], &x, sizeof(x));
for (size_t i = 0; i < rows; i += storage.index_granularity)
```
-**7.** Add spaces around binary operators (`+`, `-`, `*`, `/`, `%`, …) and the ternary operator `?:`.
+**7.** Add spaces around binary operators (`+`, `-`, `*`, `/`, `%`, ...) and the ternary operator `?:`.
``` cpp
UInt16 year = (s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
@@ -86,7 +86,7 @@ dst.ClickGoodEvent = click.GoodEvent;
If necessary, the operator can be wrapped to the next line. In this case, the offset in front of it is increased.
-**11.** Do not use a space to separate unary operators (`--`, `++`, `*`, `&`, …) from the argument.
+**11.** Do not use a space to separate unary operators (`--`, `++`, `*`, `&`, ...) from the argument.
**12.** Put a space after a comma, but not before it. The same rule goes for a semicolon inside a `for` expression.
@@ -115,7 +115,7 @@ public:
**16.** If the same `namespace` is used for the entire file, and there isn’t anything else significant, an offset is not necessary inside `namespace`.
-**17.** If the block for an `if`, `for`, `while`, or other expression consists of a single `statement`, the curly brackets are optional. Place the `statement` on a separate line, instead. This rule is also valid for nested `if`, `for`, `while`, …
+**17.** If the block for an `if`, `for`, `while`, or other expression consists of a single `statement`, the curly brackets are optional. Place the `statement` on a separate line, instead. This rule is also valid for nested `if`, `for`, `while`, ...
But if the inner `statement` contains curly brackets or `else`, the external block should be written in curly brackets.
diff --git a/docs/en/engines/table-engines/integrations/hdfs.md b/docs/en/engines/table-engines/integrations/hdfs.md
index dbd1c270a4a..2749fa7e479 100644
--- a/docs/en/engines/table-engines/integrations/hdfs.md
+++ b/docs/en/engines/table-engines/integrations/hdfs.md
@@ -118,7 +118,7 @@ If the listing of files contains number ranges with leading zeros, use the const
**Example**
-Create table with files named `file000`, `file001`, … , `file999`:
+Create table with files named `file000`, `file001`, ... , `file999`:
``` sql
CREATE TABLE big_table (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV')
diff --git a/docs/en/engines/table-engines/integrations/s3.md b/docs/en/engines/table-engines/integrations/s3.md
index dfa06801d04..cb1da1c8e68 100644
--- a/docs/en/engines/table-engines/integrations/s3.md
+++ b/docs/en/engines/table-engines/integrations/s3.md
@@ -178,7 +178,7 @@ If the listing of files contains number ranges with leading zeros, use the const
**Example with wildcards 1**
-Create table with files named `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
+Create table with files named `file-000.csv`, `file-001.csv`, ... , `file-999.csv`:
``` sql
CREATE TABLE big_table (name String, value UInt32)
diff --git a/docs/en/engines/table-engines/integrations/s3queue.md b/docs/en/engines/table-engines/integrations/s3queue.md
index 8ebab80423f..aa7fa512480 100644
--- a/docs/en/engines/table-engines/integrations/s3queue.md
+++ b/docs/en/engines/table-engines/integrations/s3queue.md
@@ -202,8 +202,7 @@ Example:
CREATE TABLE s3queue_engine_table (name String, value UInt32)
ENGINE=S3Queue('https://clickhouse-public-datasets.s3.amazonaws.com/my-test-bucket-768/*', 'CSV', 'gzip')
SETTINGS
- mode = 'unordered',
- keeper_path = '/clickhouse/s3queue/';
+ mode = 'unordered';
CREATE TABLE stats (name String, value UInt32)
ENGINE = MergeTree() ORDER BY name;
diff --git a/docs/en/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/en/engines/table-engines/mergetree-family/custom-partitioning-key.md
index 23d98d4b20e..eda87fd06c1 100644
--- a/docs/en/engines/table-engines/mergetree-family/custom-partitioning-key.md
+++ b/docs/en/engines/table-engines/mergetree-family/custom-partitioning-key.md
@@ -71,7 +71,7 @@ WHERE table = 'visits'
└───────────┴───────────────────┴────────┘
```
-The `partition` column contains the names of the partitions. There are two partitions in this example: `201901` and `201902`. You can use this column value to specify the partition name in [ALTER … PARTITION](../../../sql-reference/statements/alter/partition.md) queries.
+The `partition` column contains the names of the partitions. There are two partitions in this example: `201901` and `201902`. You can use this column value to specify the partition name in [ALTER ... PARTITION](../../../sql-reference/statements/alter/partition.md) queries.
The `name` column contains the names of the partition data parts. You can use this column to specify the name of the part in the [ALTER ATTACH PART](../../../sql-reference/statements/alter/partition.md#alter_attach-partition) query.
diff --git a/docs/en/engines/table-engines/mergetree-family/mergetree.md b/docs/en/engines/table-engines/mergetree-family/mergetree.md
index 7862eef69f8..a009c4a32f3 100644
--- a/docs/en/engines/table-engines/mergetree-family/mergetree.md
+++ b/docs/en/engines/table-engines/mergetree-family/mergetree.md
@@ -954,7 +954,7 @@ In the case of `MergeTree` tables, data is getting to disk in different ways:
- As a result of an insert (`INSERT` query).
- During background merges and [mutations](/docs/en/sql-reference/statements/alter/index.md#alter-mutations).
- When downloading from another replica.
-- As a result of partition freezing [ALTER TABLE … FREEZE PARTITION](/docs/en/sql-reference/statements/alter/partition.md/#alter_freeze-partition).
+- As a result of partition freezing [ALTER TABLE ... FREEZE PARTITION](/docs/en/sql-reference/statements/alter/partition.md/#alter_freeze-partition).
In all these cases except for mutations and partition freezing, a part is stored on a volume and a disk according to the given storage policy:
@@ -966,7 +966,7 @@ Under the hood, mutations and partition freezing make use of [hard links](https:
In the background, parts are moved between volumes on the basis of the amount of free space (`move_factor` parameter) according to the order the volumes are declared in the configuration file.
Data is never transferred from the last one and into the first one. One may use system tables [system.part_log](/docs/en/operations/system-tables/part_log.md/#system_tables-part-log) (field `type = MOVE_PART`) and [system.parts](/docs/en/operations/system-tables/parts.md/#system_tables-parts) (fields `path` and `disk`) to monitor background moves. Also, the detailed information can be found in server logs.
-User can force moving a part or a partition from one volume to another using the query [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](/docs/en/sql-reference/statements/alter/partition.md/#alter_move-partition), all the restrictions for background operations are taken into account. The query initiates a move on its own and does not wait for background operations to be completed. User will get an error message if not enough free space is available or if any of the required conditions are not met.
+User can force moving a part or a partition from one volume to another using the query [ALTER TABLE ... MOVE PART\|PARTITION ... TO VOLUME\|DISK ...](/docs/en/sql-reference/statements/alter/partition.md/#alter_move-partition), all the restrictions for background operations are taken into account. The query initiates a move on its own and does not wait for background operations to be completed. User will get an error message if not enough free space is available or if any of the required conditions are not met.
Moving data does not interfere with data replication. Therefore, different storage policies can be specified for the same table on different replicas.
diff --git a/docs/en/engines/table-engines/special/external-data.md b/docs/en/engines/table-engines/special/external-data.md
index 7ea3f3e30d6..f6d6dae7eb6 100644
--- a/docs/en/engines/table-engines/special/external-data.md
+++ b/docs/en/engines/table-engines/special/external-data.md
@@ -29,7 +29,7 @@ Only a single table can be retrieved from stdin.
The following parameters are optional: **–name**– Name of the table. If omitted, _data is used.
**–format** – Data format in the file. If omitted, TabSeparated is used.
-One of the following parameters is required:**–types** – A list of comma-separated column types. For example: `UInt64,String`. The columns will be named _1, _2, …
+One of the following parameters is required:**–types** – A list of comma-separated column types. For example: `UInt64,String`. The columns will be named _1, _2, ...
**–structure**– The table structure in the format`UserID UInt64`, `URL String`. Defines the column names and types.
The files specified in ‘file’ will be parsed by the format specified in ‘format’, using the data types specified in ‘types’ or ‘structure’. The table will be uploaded to the server and accessible there as a temporary table with the name in ‘name’.
diff --git a/docs/en/engines/table-engines/special/file.md b/docs/en/engines/table-engines/special/file.md
index fdf5242ba3b..0d422f64762 100644
--- a/docs/en/engines/table-engines/special/file.md
+++ b/docs/en/engines/table-engines/special/file.md
@@ -14,6 +14,10 @@ Usage scenarios:
- Convert data from one format to another.
- Updating data in ClickHouse via editing a file on a disk.
+:::note
+This engine is not currently available in ClickHouse Cloud, please [use the S3 table function instead](/docs/en/sql-reference/table-functions/s3.md).
+:::
+
## Usage in ClickHouse Server {#usage-in-clickhouse-server}
``` sql
diff --git a/docs/en/interfaces/formats.md b/docs/en/interfaces/formats.md
index a137eb2bdf2..66d5bd2e574 100644
--- a/docs/en/interfaces/formats.md
+++ b/docs/en/interfaces/formats.md
@@ -197,6 +197,7 @@ SELECT * FROM nestedt FORMAT TSV
- [input_format_tsv_enum_as_number](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_enum_as_number) - treat inserted enum values in TSV formats as enum indices. Default value - `false`.
- [input_format_tsv_use_best_effort_in_schema_inference](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_use_best_effort_in_schema_inference) - use some tweaks and heuristics to infer schema in TSV format. If disabled, all fields will be inferred as Strings. Default value - `true`.
- [output_format_tsv_crlf_end_of_line](/docs/en/operations/settings/settings-formats.md/#output_format_tsv_crlf_end_of_line) - if it is set true, end of line in TSV output format will be `\r\n` instead of `\n`. Default value - `false`.
+- [input_format_tsv_crlf_end_of_line](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_crlf_end_of_line) - if it is set true, end of line in TSV input format will be `\r\n` instead of `\n`. Default value - `false`.
- [input_format_tsv_skip_first_lines](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_skip_first_lines) - skip specified number of lines at the beginning of data. Default value - `0`.
- [input_format_tsv_detect_header](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_detect_header) - automatically detect header with names and types in TSV format. Default value - `true`.
- [input_format_tsv_skip_trailing_empty_lines](/docs/en/operations/settings/settings-formats.md/#input_format_tsv_skip_trailing_empty_lines) - skip trailing empty lines at the end of data. Default value - `false`.
diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md
index 28831404a1f..a5fe74fd0c6 100644
--- a/docs/en/operations/server-configuration-parameters/settings.md
+++ b/docs/en/operations/server-configuration-parameters/settings.md
@@ -561,6 +561,25 @@ Default value: 5000
400
```
+## max\_view\_num\_to\_warn {#max-view-num-to-warn}
+If the number of attached views exceeds the specified value, clickhouse server will add warning messages to `system.warnings` table.
+Default value: 10000
+
+**Example**
+
+``` xml
+400
+```
+
+## max\_dictionary\_num\_to\_warn {#max-dictionary-num-to-warn}
+If the number of attached dictionaries exceeds the specified value, clickhouse server will add warning messages to `system.warnings` table.
+Default value: 1000
+
+**Example**
+
+``` xml
+400
+```
## max\_part\_num\_to\_warn {#max-part-num-to-warn}
If the number of active parts exceeds the specified value, clickhouse server will add warning messages to `system.warnings` table.
diff --git a/docs/en/operations/settings/query-complexity.md b/docs/en/operations/settings/query-complexity.md
index d86f18ff982..2a20e74e20f 100644
--- a/docs/en/operations/settings/query-complexity.md
+++ b/docs/en/operations/settings/query-complexity.md
@@ -303,7 +303,7 @@ What to do when the amount of data exceeds one of the limits: ‘throw’ or ‘
Limits the number of rows in the hash table that is used when joining tables.
-This settings applies to [SELECT … JOIN](../../sql-reference/statements/select/join.md#select-join) operations and the [Join](../../engines/table-engines/special/join.md) table engine.
+This settings applies to [SELECT ... JOIN](../../sql-reference/statements/select/join.md#select-join) operations and the [Join](../../engines/table-engines/special/join.md) table engine.
If a query contains multiple joins, ClickHouse checks this setting for every intermediate result.
@@ -320,7 +320,7 @@ Default value: 0.
Limits the size in bytes of the hash table used when joining tables.
-This setting applies to [SELECT … JOIN](../../sql-reference/statements/select/join.md#select-join) operations and [Join table engine](../../engines/table-engines/special/join.md).
+This setting applies to [SELECT ... JOIN](../../sql-reference/statements/select/join.md#select-join) operations and [Join table engine](../../engines/table-engines/special/join.md).
If the query contains joins, ClickHouse checks this setting for every intermediate result.
diff --git a/docs/en/operations/settings/settings-formats.md b/docs/en/operations/settings/settings-formats.md
index 6666f68c177..1a27b350652 100644
--- a/docs/en/operations/settings/settings-formats.md
+++ b/docs/en/operations/settings/settings-formats.md
@@ -831,7 +831,13 @@ Default value: `0`.
### output_format_tsv_crlf_end_of_line {#output_format_tsv_crlf_end_of_line}
-Use DOC/Windows-style line separator (CRLF) in TSV instead of Unix style (LF).
+Use DOS/Windows-style line separator (CRLF) in TSV instead of Unix style (LF).
+
+Disabled by default.
+
+### input_format_tsv_crlf_end_of_line {#input_format_tsv_crlf_end_of_line}
+
+Use DOS/Windows-style line separator (CRLF) for TSV input files instead of Unix style (LF).
Disabled by default.
diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md
index 91b544c6a82..252b041ef6f 100644
--- a/docs/en/operations/settings/settings.md
+++ b/docs/en/operations/settings/settings.md
@@ -2248,7 +2248,7 @@ Default value: 0.
## count_distinct_implementation {#count_distinct_implementation}
-Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference/count.md/#agg_function-count) construction.
+Specifies which of the `uniq*` functions should be used to perform the [COUNT(DISTINCT ...)](../../sql-reference/aggregate-functions/reference/count.md/#agg_function-count) construction.
Possible values:
@@ -3665,6 +3665,26 @@ Possible values:
Default value: `0`.
+## s3_ignore_file_doesnt_exist {#s3_ignore_file_doesnt_exist}
+
+Ignore absence of file if it does not exist when reading certain keys.
+
+Possible values:
+- 1 — `SELECT` returns empty result.
+- 0 — `SELECT` throws an exception.
+
+Default value: `0`.
+
+## s3_validate_request_settings {#s3_validate_request_settings}
+
+Enables s3 request settings validation.
+
+Possible values:
+- 1 — validate settings.
+- 0 — do not validate settings.
+
+Default value: `1`.
+
## hdfs_truncate_on_insert {#hdfs_truncate_on_insert}
Enables or disables truncation before an insert in hdfs engine tables. If disabled, an exception will be thrown on an attempt to insert if a file in HDFS already exists.
@@ -3697,6 +3717,56 @@ Possible values:
Default value: `0`.
+## hdfs_throw_on_zero_files_match {#hdfs_throw_on_zero_files_match}
+
+Throw an error if matched zero files according to glob expansion rules.
+
+Possible values:
+- 1 — `SELECT` throws an exception.
+- 0 — `SELECT` returns empty result.
+
+Default value: `0`.
+
+## hdfs_ignore_file_doesnt_exist {#hdfs_ignore_file_doesnt_exist}
+
+Ignore absence of file if it does not exist when reading certain keys.
+
+Possible values:
+- 1 — `SELECT` returns empty result.
+- 0 — `SELECT` throws an exception.
+
+Default value: `0`.
+
+## azure_throw_on_zero_files_match {#azure_throw_on_zero_files_match}
+
+Throw an error if matched zero files according to glob expansion rules.
+
+Possible values:
+- 1 — `SELECT` throws an exception.
+- 0 — `SELECT` returns empty result.
+
+Default value: `0`.
+
+## azure_ignore_file_doesnt_exist {#azure_ignore_file_doesnt_exist}
+
+Ignore absence of file if it does not exist when reading certain keys.
+
+Possible values:
+- 1 — `SELECT` returns empty result.
+- 0 — `SELECT` throws an exception.
+
+Default value: `0`.
+
+## azure_skip_empty_files {#azure_skip_empty_files}
+
+Enables or disables skipping empty files in S3 engine.
+
+Possible values:
+- 0 — `SELECT` throws an exception if empty file is not compatible with requested format.
+- 1 — `SELECT` returns empty result for empty file.
+
+Default value: `0`.
+
## engine_url_skip_empty_files {#engine_url_skip_empty_files}
Enables or disables skipping empty files in [URL](../../engines/table-engines/special/url.md) engine tables.
@@ -5468,3 +5538,15 @@ Defines how MySQL types are converted to corresponding ClickHouse types. A comma
- `datetime64`: convert `DATETIME` and `TIMESTAMP` types to `DateTime64` instead of `DateTime` when precision is not `0`.
- `date2Date32`: convert `DATE` to `Date32` instead of `Date`. Takes precedence over `date2String`.
- `date2String`: convert `DATE` to `String` instead of `Date`. Overridden by `datetime64`.
+
+## cross_join_min_rows_to_compress
+
+Minimal count of rows to compress block in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached.
+
+Default value: `10000000`.
+
+## cross_join_min_bytes_to_compress
+
+Minimal size of block to compress in CROSS JOIN. Zero value means - disable this threshold. This block is compressed when any of the two thresholds (by rows or by bytes) are reached.
+
+Default value: `1GiB`.
diff --git a/docs/en/operations/storing-data.md b/docs/en/operations/storing-data.md
index 9b316960750..53ecd66396d 100644
--- a/docs/en/operations/storing-data.md
+++ b/docs/en/operations/storing-data.md
@@ -421,6 +421,7 @@ Other parameters:
* `skip_access_check` - If true, disk access checks will not be performed on disk start-up. Default value is `false`.
* `read_resource` — Resource name to be used for [scheduling](/docs/en/operations/workload-scheduling.md) of read requests to this disk. Default value is empty string (IO scheduling is not enabled for this disk).
* `write_resource` — Resource name to be used for [scheduling](/docs/en/operations/workload-scheduling.md) of write requests to this disk. Default value is empty string (IO scheduling is not enabled for this disk).
+* `metadata_keep_free_space_bytes` - the amount of free metadata disk space to be reserved.
Examples of working configurations can be found in integration tests directory (see e.g. [test_merge_tree_azure_blob_storage](https://github.com/ClickHouse/ClickHouse/blob/master/tests/integration/test_merge_tree_azure_blob_storage/configs/config.d/storage_conf.xml) or [test_azure_blob_storage_zero_copy_replication](https://github.com/ClickHouse/ClickHouse/blob/master/tests/integration/test_azure_blob_storage_zero_copy_replication/configs/config.d/storage_conf.xml)).
diff --git a/docs/en/sql-reference/aggregate-functions/parametric-functions.md b/docs/en/sql-reference/aggregate-functions/parametric-functions.md
index 8981ac1f752..1dc89b8dcf9 100644
--- a/docs/en/sql-reference/aggregate-functions/parametric-functions.md
+++ b/docs/en/sql-reference/aggregate-functions/parametric-functions.md
@@ -82,7 +82,7 @@ FROM
In this case, you should remember that you do not know the histogram bin borders.
-## sequenceMatch(pattern)(timestamp, cond1, cond2, …)
+## sequenceMatch(pattern)(timestamp, cond1, cond2, ...)
Checks whether the sequence contains an event chain that matches the pattern.
@@ -172,7 +172,7 @@ SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM
- [sequenceCount](#function-sequencecount)
-## sequenceCount(pattern)(time, cond1, cond2, …)
+## sequenceCount(pattern)(time, cond1, cond2, ...)
Counts the number of event chains that matched the pattern. The function searches event chains that do not overlap. It starts to search for the next chain after the current chain is matched.
diff --git a/docs/en/sql-reference/aggregate-functions/reference/quantiles.md b/docs/en/sql-reference/aggregate-functions/reference/quantiles.md
index e2a5bc53e32..856d447ac13 100644
--- a/docs/en/sql-reference/aggregate-functions/reference/quantiles.md
+++ b/docs/en/sql-reference/aggregate-functions/reference/quantiles.md
@@ -7,7 +7,7 @@ sidebar_position: 201
## quantiles
-Syntax: `quantiles(level1, level2, …)(x)`
+Syntax: `quantiles(level1, level2, ...)(x)`
All the quantile functions also have corresponding quantiles functions: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantileInterpolatedWeighted`, `quantilesTDigest`, `quantilesBFloat16`, `quantilesDD`. These functions calculate all the quantiles of the listed levels in one pass, and return an array of the resulting values.
diff --git a/docs/en/sql-reference/data-types/aggregatefunction.md b/docs/en/sql-reference/data-types/aggregatefunction.md
index 87511a505dc..37f0d0e50ae 100644
--- a/docs/en/sql-reference/data-types/aggregatefunction.md
+++ b/docs/en/sql-reference/data-types/aggregatefunction.md
@@ -6,9 +6,9 @@ sidebar_label: AggregateFunction
# AggregateFunction
-Aggregate functions can have an implementation-defined intermediate state that can be serialized to an `AggregateFunction(…)` data type and stored in a table, usually, by means of [a materialized view](../../sql-reference/statements/create/view.md). The common way to produce an aggregate function state is by calling the aggregate function with the `-State` suffix. To get the final result of aggregation in the future, you must use the same aggregate function with the `-Merge`suffix.
+Aggregate functions can have an implementation-defined intermediate state that can be serialized to an `AggregateFunction(...)` data type and stored in a table, usually, by means of [a materialized view](../../sql-reference/statements/create/view.md). The common way to produce an aggregate function state is by calling the aggregate function with the `-State` suffix. To get the final result of aggregation in the future, you must use the same aggregate function with the `-Merge`suffix.
-`AggregateFunction(name, types_of_arguments…)` — parametric data type.
+`AggregateFunction(name, types_of_arguments...)` — parametric data type.
**Parameters**
diff --git a/docs/en/sql-reference/data-types/dynamic.md b/docs/en/sql-reference/data-types/dynamic.md
new file mode 100644
index 00000000000..955fd54e641
--- /dev/null
+++ b/docs/en/sql-reference/data-types/dynamic.md
@@ -0,0 +1,495 @@
+---
+slug: /en/sql-reference/data-types/dynamic
+sidebar_position: 56
+sidebar_label: Dynamic
+---
+
+# Dynamic
+
+This type allows to store values of any type inside it without knowing all of them in advance.
+
+To declare a column of `Dynamic` type, use the following syntax:
+
+``` sql
+ Dynamic(max_types=N)
+```
+
+Where `N` is an optional parameter between `1` and `255` indicating how many different data types can be stored inside a column with type `Dynamic` across single block of data that is stored separately (for example across single data part for MergeTree table). If this limit is exceeded, all new types will be converted to type `String`. Default value of `max_types` is `32`.
+
+:::note
+The Dynamic data type is an experimental feature. To use it, set `allow_experimental_dynamic_type = 1`.
+:::
+
+## Creating Dynamic
+
+Using `Dynamic` type in table column definition:
+
+```sql
+CREATE TABLE test (d Dynamic) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), ('Hello, World!'), ([1, 2, 3]);
+SELECT d, dynamicType(d) FROM test;
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┐
+│ ᴺᵁᴸᴸ │ None │
+│ 42 │ Int64 │
+│ Hello, World! │ String │
+│ [1,2,3] │ Array(Int64) │
+└───────────────┴────────────────┘
+```
+
+Using CAST from ordinary column:
+
+```sql
+SELECT 'Hello, World!'::Dynamic as d, dynamicType(d);
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┐
+│ Hello, World! │ String │
+└───────────────┴────────────────┘
+```
+
+Using CAST from `Variant` column:
+
+```sql
+SET allow_experimental_variant_type = 1, use_variant_as_common_type = 1;
+SELECT multiIf((number % 3) = 0, number, (number % 3) = 1, range(number + 1), NULL)::Dynamic AS d, dynamicType(d) FROM numbers(3)
+```
+
+```text
+┌─d─────┬─dynamicType(d)─┐
+│ 0 │ UInt64 │
+│ [0,1] │ Array(UInt64) │
+│ ᴺᵁᴸᴸ │ None │
+└───────┴────────────────┘
+```
+
+
+## Reading Dynamic nested types as subcolumns
+
+`Dynamic` type supports reading a single nested type from a `Dynamic` column using the type name as a subcolumn.
+So, if you have column `d Dynamic` you can read a subcolumn of any valid type `T` using syntax `d.T`,
+this subcolumn will have type `Nullable(T)` if `T` can be inside `Nullable` and `T` otherwise. This subcolumn will
+be the same size as original `Dynamic` column and will contain `NULL` values (or empty values if `T` cannot be inside `Nullable`)
+in all rows in which original `Dynamic` column doesn't have type `T`.
+
+`Dynamic` subcolumns can be also read using function `dynamicElement(dynamic_column, type_name)`.
+
+Examples:
+
+```sql
+CREATE TABLE test (d Dynamic) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), ('Hello, World!'), ([1, 2, 3]);
+SELECT d, dynamicType(d), d.String, d.Int64, d.`Array(Int64)`, d.Date, d.`Array(String)` FROM test;
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┬─d.String──────┬─d.Int64─┬─d.Array(Int64)─┬─d.Date─┬─d.Array(String)─┐
+│ ᴺᵁᴸᴸ │ None │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [] │ ᴺᵁᴸᴸ │ [] │
+│ 42 │ Int64 │ ᴺᵁᴸᴸ │ 42 │ [] │ ᴺᵁᴸᴸ │ [] │
+│ Hello, World! │ String │ Hello, World! │ ᴺᵁᴸᴸ │ [] │ ᴺᵁᴸᴸ │ [] │
+│ [1,2,3] │ Array(Int64) │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [1,2,3] │ ᴺᵁᴸᴸ │ [] │
+└───────────────┴────────────────┴───────────────┴─────────┴────────────────┴────────┴─────────────────┘
+```
+
+```sql
+SELECT toTypeName(d.String), toTypeName(d.Int64), toTypeName(d.`Array(Int64)`), toTypeName(d.Date), toTypeName(d.`Array(String)`) FROM test LIMIT 1;
+```
+
+```text
+┌─toTypeName(d.String)─┬─toTypeName(d.Int64)─┬─toTypeName(d.Array(Int64))─┬─toTypeName(d.Date)─┬─toTypeName(d.Array(String))─┐
+│ Nullable(String) │ Nullable(Int64) │ Array(Int64) │ Nullable(Date) │ Array(String) │
+└──────────────────────┴─────────────────────┴────────────────────────────┴────────────────────┴─────────────────────────────┘
+```
+
+```sql
+SELECT d, dynamicType(d), dynamicElement(d, 'String'), dynamicElement(d, 'Int64'), dynamicElement(d, 'Array(Int64)'), dynamicElement(d, 'Date'), dynamicElement(d, 'Array(String)') FROM test;```
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┬─dynamicElement(d, 'String')─┬─dynamicElement(d, 'Int64')─┬─dynamicElement(d, 'Array(Int64)')─┬─dynamicElement(d, 'Date')─┬─dynamicElement(d, 'Array(String)')─┐
+│ ᴺᵁᴸᴸ │ None │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [] │ ᴺᵁᴸᴸ │ [] │
+│ 42 │ Int64 │ ᴺᵁᴸᴸ │ 42 │ [] │ ᴺᵁᴸᴸ │ [] │
+│ Hello, World! │ String │ Hello, World! │ ᴺᵁᴸᴸ │ [] │ ᴺᵁᴸᴸ │ [] │
+│ [1,2,3] │ Array(Int64) │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [1,2,3] │ ᴺᵁᴸᴸ │ [] │
+└───────────────┴────────────────┴─────────────────────────────┴────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────────────────────┘
+```
+
+To know what variant is stored in each row function `dynamicType(dynamic_column)` can be used. It returns `String` with value type name for each row (or `'None'` if row is `NULL`).
+
+Example:
+
+```sql
+CREATE TABLE test (d Dynamic) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), ('Hello, World!'), ([1, 2, 3]);
+SELECT dynamicType(d) from test;
+```
+
+```text
+┌─dynamicType(d)─┐
+│ None │
+│ Int64 │
+│ String │
+│ Array(Int64) │
+└────────────────┘
+```
+
+## Conversion between Dynamic column and other columns
+
+There are 4 possible conversions that can be performed with `Dynamic` column.
+
+### Converting an ordinary column to a Dynamic column
+
+```sql
+SELECT 'Hello, World!'::Dynamic as d, dynamicType(d);
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┐
+│ Hello, World! │ String │
+└───────────────┴────────────────┘
+```
+
+### Converting a String column to a Dynamic column through parsing
+
+To parse `Dynamic` type values from a `String` column you can enable setting `cast_string_to_dynamic_use_inference`:
+
+```sql
+SET cast_string_to_dynamic_use_inference = 1;
+SELECT CAST(materialize(map('key1', '42', 'key2', 'true', 'key3', '2020-01-01')), 'Map(String, Dynamic)') as map_of_dynamic, mapApply((k, v) -> (k, dynamicType(v)), map_of_dynamic) as map_of_dynamic_types;
+```
+
+```text
+┌─map_of_dynamic──────────────────────────────┬─map_of_dynamic_types─────────────────────────┐
+│ {'key1':42,'key2':true,'key3':'2020-01-01'} │ {'key1':'Int64','key2':'Bool','key3':'Date'} │
+└─────────────────────────────────────────────┴──────────────────────────────────────────────┘
+```
+
+### Converting a Dynamic column to an ordinary column
+
+It is possible to convert a `Dynamic` column to an ordinary column. In this case all nested types will be converted to a destination type:
+
+```sql
+CREATE TABLE test (d Dynamic) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), ('42.42'), (true), ('e10');
+SELECT d::Nullable(Float64) FROM test;
+```
+
+```text
+┌─CAST(d, 'Nullable(Float64)')─┐
+│ ᴺᵁᴸᴸ │
+│ 42 │
+│ 42.42 │
+│ 1 │
+│ 0 │
+└──────────────────────────────┘
+```
+
+### Converting a Variant column to Dynamic column
+
+```sql
+CREATE TABLE test (v Variant(UInt64, String, Array(UInt64))) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), ('String'), ([1, 2, 3]);
+SELECT v::Dynamic as d, dynamicType(d) from test;
+```
+
+```text
+┌─d───────┬─dynamicType(d)─┐
+│ ᴺᵁᴸᴸ │ None │
+│ 42 │ UInt64 │
+│ String │ String │
+│ [1,2,3] │ Array(UInt64) │
+└─────────┴────────────────┘
+```
+
+### Converting a Dynamic(max_types=N) column to another Dynamic(max_types=K)
+
+If `K >= N` than during conversion the data doesn't change:
+
+```sql
+CREATE TABLE test (d Dynamic(max_types=3)) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), (43), ('42.42'), (true);
+SELECT d::Dynamic(max_types=5) as d2, dynamicType(d2) FROM test;
+```
+
+```text
+┌─d─────┬─dynamicType(d)─┐
+│ ᴺᵁᴸᴸ │ None │
+│ 42 │ Int64 │
+│ 43 │ Int64 │
+│ 42.42 │ String │
+│ true │ Bool │
+└───────┴────────────────┘
+```
+
+If `K < N`, then the values with the rarest types are converted to `String`:
+```text
+CREATE TABLE test (d Dynamic(max_types=4)) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), (43), ('42.42'), (true), ([1, 2, 3]);
+SELECT d, dynamicType(d), d::Dynamic(max_types=2) as d2, dynamicType(d2) FROM test;
+```
+
+```text
+┌─d───────┬─dynamicType(d)─┬─d2──────┬─dynamicType(d2)─┐
+│ ᴺᵁᴸᴸ │ None │ ᴺᵁᴸᴸ │ None │
+│ 42 │ Int64 │ 42 │ Int64 │
+│ 43 │ Int64 │ 43 │ Int64 │
+│ 42.42 │ String │ 42.42 │ String │
+│ true │ Bool │ true │ String │
+│ [1,2,3] │ Array(Int64) │ [1,2,3] │ String │
+└─────────┴────────────────┴─────────┴─────────────────┘
+```
+
+If `K=1`, all types are converted to `String`:
+
+```text
+CREATE TABLE test (d Dynamic(max_types=4)) ENGINE = Memory;
+INSERT INTO test VALUES (NULL), (42), (43), ('42.42'), (true), ([1, 2, 3]);
+SELECT d, dynamicType(d), d::Dynamic(max_types=1) as d2, dynamicType(d2) FROM test;
+```
+
+```text
+┌─d───────┬─dynamicType(d)─┬─d2──────┬─dynamicType(d2)─┐
+│ ᴺᵁᴸᴸ │ None │ ᴺᵁᴸᴸ │ None │
+│ 42 │ Int64 │ 42 │ String │
+│ 43 │ Int64 │ 43 │ String │
+│ 42.42 │ String │ 42.42 │ String │
+│ true │ Bool │ true │ String │
+│ [1,2,3] │ Array(Int64) │ [1,2,3] │ String │
+└─────────┴────────────────┴─────────┴─────────────────┘
+```
+
+## Reading Dynamic type from the data
+
+All text formats (TSV, CSV, CustomSeparated, Values, JSONEachRow, etc) supports reading `Dynamic` type. During data parsing ClickHouse tries to infer the type of each value and use it during insertion to `Dynamic` column.
+
+Example:
+
+```sql
+SELECT
+ d,
+ dynamicType(d),
+ dynamicElement(d, 'String') AS str,
+ dynamicElement(d, 'Int64') AS num,
+ dynamicElement(d, 'Float64') AS float,
+ dynamicElement(d, 'Date') AS date,
+ dynamicElement(d, 'Array(Int64)') AS arr
+FROM format(JSONEachRow, 'd Dynamic', $$
+{"d" : "Hello, World!"},
+{"d" : 42},
+{"d" : 42.42},
+{"d" : "2020-01-01"},
+{"d" : [1, 2, 3]}
+$$)
+```
+
+```text
+┌─d─────────────┬─dynamicType(d)─┬─str───────────┬──num─┬─float─┬───────date─┬─arr─────┐
+│ Hello, World! │ String │ Hello, World! │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [] │
+│ 42 │ Int64 │ ᴺᵁᴸᴸ │ 42 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [] │
+│ 42.42 │ Float64 │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 42.42 │ ᴺᵁᴸᴸ │ [] │
+│ 2020-01-01 │ Date │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ 2020-01-01 │ [] │
+│ [1,2,3] │ Array(Int64) │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │ [1,2,3] │
+└───────────────┴────────────────┴───────────────┴──────┴───────┴────────────┴─────────┘
+```
+
+## Comparing values of Dynamic type
+
+Values of `Dynamic` types are compared similar to values of `Variant` type:
+The result of operator `<` for values `d1` with underlying type `T1` and `d2` with underlying type `T2` of a type `Dynamic` is defined as follows:
+- If `T1 = T2 = T`, the result will be `d1.T < d2.T` (underlying values will be compared).
+- If `T1 != T2`, the result will be `T1 < T2` (type names will be compared).
+
+Examples:
+```sql
+CREATE TABLE test (d1 Dynamic, d2 Dynamic) ENGINE=Memory;
+INSERT INTO test VALUES (42, 42), (42, 43), (42, 'abc'), (42, [1, 2, 3]), (42, []), (42, NULL);
+```
+
+```sql
+SELECT d2, dynamicType(d2) as d2_type from test order by d2;
+```
+
+```text
+┌─d2──────┬─d2_type──────┐
+│ [] │ Array(Int64) │
+│ [1,2,3] │ Array(Int64) │
+│ 42 │ Int64 │
+│ 43 │ Int64 │
+│ abc │ String │
+│ ᴺᵁᴸᴸ │ None │
+└─────────┴──────────────┘
+```
+
+```sql
+SELECT d1, dynamicType(d1) as d1_type, d2, dynamicType(d2) as d2_type, d1 = d2, d1 < d2, d1 > d2 from test;
+```
+
+```text
+┌─d1─┬─d1_type─┬─d2──────┬─d2_type──────┬─equals(d1, d2)─┬─less(d1, d2)─┬─greater(d1, d2)─┐
+│ 42 │ Int64 │ 42 │ Int64 │ 1 │ 0 │ 0 │
+│ 42 │ Int64 │ 43 │ Int64 │ 0 │ 1 │ 0 │
+│ 42 │ Int64 │ abc │ String │ 0 │ 1 │ 0 │
+│ 42 │ Int64 │ [1,2,3] │ Array(Int64) │ 0 │ 0 │ 1 │
+│ 42 │ Int64 │ [] │ Array(Int64) │ 0 │ 0 │ 1 │
+│ 42 │ Int64 │ ᴺᵁᴸᴸ │ None │ 0 │ 1 │ 0 │
+└────┴─────────┴─────────┴──────────────┴────────────────┴──────────────┴─────────────────┘
+```
+
+If you need to find the row with specific `Dynamic` value, you can do one of the following:
+
+- Cast value to the `Dynamic` type:
+
+```sql
+SELECT * FROM test WHERE d2 == [1,2,3]::Array(UInt32)::Dynamic;
+```
+
+```text
+┌─d1─┬─d2──────┐
+│ 42 │ [1,2,3] │
+└────┴─────────┘
+```
+
+- Compare `Dynamic` subcolumn with required type:
+
+```sql
+SELECT * FROM test WHERE d2.`Array(Int65)` == [1,2,3] -- or using variantElement(d2, 'Array(UInt32)')
+```
+
+```text
+┌─d1─┬─d2──────┐
+│ 42 │ [1,2,3] │
+└────┴─────────┘
+```
+
+Sometimes it can be useful to make additional check on dynamic type as subcolumns with complex types like `Array/Map/Tuple` cannot be inside `Nullable` and will have default values instead of `NULL` on rows with different types:
+
+```sql
+SELECT d2, d2.`Array(Int64)`, dynamicType(d2) FROM test WHERE d2.`Array(Int64)` == [];
+```
+
+```text
+┌─d2───┬─d2.Array(UInt32)─┬─dynamicType(d2)─┐
+│ 42 │ [] │ Int64 │
+│ 43 │ [] │ Int64 │
+│ abc │ [] │ String │
+│ [] │ [] │ Array(Int32) │
+│ ᴺᵁᴸᴸ │ [] │ None │
+└──────┴──────────────────┴─────────────────┘
+```
+
+```sql
+SELECT d2, d2.`Array(Int64)`, dynamicType(d2) FROM test WHERE dynamicType(d2) == 'Array(Int64)' AND d2.`Array(Int64)` == [];
+```
+
+```text
+┌─d2─┬─d2.Array(UInt32)─┬─dynamicType(d2)─┐
+│ [] │ [] │ Array(Int64) │
+└────┴──────────────────┴─────────────────┘
+```
+
+**Note:** values of dynamic types with different numeric types are considered as different values and not compared between each other, their type names are compared instead.
+
+Example:
+
+```sql
+CREATE TABLE test (d Dynamic) ENGINE=Memory;
+INSERT INTO test VALUES (1::UInt32), (1::Int64), (100::UInt32), (100::Int64);
+SELECT d, dynamicType(d) FROM test ORDER by d;
+```
+
+```text
+┌─v───┬─dynamicType(v)─┐
+│ 1 │ Int64 │
+│ 100 │ Int64 │
+│ 1 │ UInt32 │
+│ 100 │ UInt32 │
+└─────┴────────────────┘
+```
+
+## Reaching the limit in number of different data types stored inside Dynamic
+
+`Dynamic` data type can store only limited number of different data types inside. By default, this limit is 32, but you can change it in type declaration using syntax `Dynamic(max_types=N)` where N is between 1 and 255 (due to implementation details, it's impossible to have more than 255 different data types inside Dynamic).
+When the limit is reached, all new data types inserted to `Dynamic` column will be casted to `String` and stored as `String` values.
+
+Let's see what happens when the limit is reached in different scenarios.
+
+### Reaching the limit during data parsing
+
+During parsing of `Dynamic` values from the data, when the limit is reached for current block of data, all new values will be inserted as `String` values:
+
+```sql
+SELECT d, dynamicType(d) FROM format(JSONEachRow, 'd Dynamic(max_types=3)', '
+{"d" : 42}
+{"d" : [1, 2, 3]}
+{"d" : "Hello, World!"}
+{"d" : "2020-01-01"}
+{"d" : ["str1", "str2", "str3"]}
+{"d" : {"a" : 1, "b" : [1, 2, 3]}}
+')
+```
+
+```text
+┌─d──────────────────────────┬─dynamicType(d)─┐
+│ 42 │ Int64 │
+│ [1,2,3] │ Array(Int64) │
+│ Hello, World! │ String │
+│ 2020-01-01 │ String │
+│ ["str1", "str2", "str3"] │ String │
+│ {"a" : 1, "b" : [1, 2, 3]} │ String │
+└────────────────────────────┴────────────────┘
+```
+
+As we can see, after inserting 3 different data types `Int64`, `Array(Int64)` and `String` all new types were converted to `String`.
+
+### During merges of data parts in MergeTree table engines
+
+During merge of several data parts in MergeTree table the `Dynamic` column in the resulting data part can reach the limit of different data types inside and won't be able to store all types from source parts.
+In this case ClickHouse chooses what types will remain after merge and what types will be casted to `String`. In most cases ClickHouse tries to keep the most frequent types and cast the rarest types to `String`, but it depends on the implementation.
+
+Let's see an example of such merge. First, let's create a table with `Dynamic` column, set the limit of different data types to `3` and insert values with `5` different types:
+
+```sql
+CREATE TABLE test (id UInt64, d Dynamic(max_types=3)) engine=MergeTree ORDER BY id;
+SYSTEM STOP MERGES test;
+INSERT INTO test SELECT number, number FROM numbers(5);
+INSERT INTO test SELECT number, range(number) FROM numbers(4);
+INSERT INTO test SELECT number, toDate(number) FROM numbers(3);
+INSERT INTO test SELECT number, map(number, number) FROM numbers(2);
+INSERT INTO test SELECT number, 'str_' || toString(number) FROM numbers(1);
+```
+
+Each insert will create a separate data pert with `Dynamic` column containing single type:
+```sql
+SELECT count(), dynamicType(d), _part FROM test GROUP BY _part, dynamicType(d) ORDER BY _part;
+```
+
+```text
+┌─count()─┬─dynamicType(d)──────┬─_part─────┐
+│ 5 │ UInt64 │ all_1_1_0 │
+│ 4 │ Array(UInt64) │ all_2_2_0 │
+│ 3 │ Date │ all_3_3_0 │
+│ 2 │ Map(UInt64, UInt64) │ all_4_4_0 │
+│ 1 │ String │ all_5_5_0 │
+└─────────┴─────────────────────┴───────────┘
+```
+
+Now, let's merge all parts into one and see what will happen:
+
+```sql
+SYSTEM START MERGES test;
+OPTIMIZE TABLE test FINAL;
+SELECT count(), dynamicType(d), _part FROM test GROUP BY _part, dynamicType(d) ORDER BY _part;
+```
+
+```text
+┌─count()─┬─dynamicType(d)─┬─_part─────┐
+│ 5 │ UInt64 │ all_1_5_2 │
+│ 6 │ String │ all_1_5_2 │
+│ 4 │ Array(UInt64) │ all_1_5_2 │
+└─────────┴────────────────┴───────────┘
+```
+
+As we can see, ClickHouse kept the most frequent types `UInt64` and `Array(UInt64)` and casted all other types to `String`.
diff --git a/docs/en/sql-reference/data-types/fixedstring.md b/docs/en/sql-reference/data-types/fixedstring.md
index 0316df7fe34..0c021b28f74 100644
--- a/docs/en/sql-reference/data-types/fixedstring.md
+++ b/docs/en/sql-reference/data-types/fixedstring.md
@@ -21,8 +21,8 @@ The `FixedString` type is efficient when data has the length of precisely `N` by
Examples of the values that can be efficiently stored in `FixedString`-typed columns:
- The binary representation of IP addresses (`FixedString(16)` for IPv6).
-- Language codes (ru_RU, en_US … ).
-- Currency codes (USD, RUB … ).
+- Language codes (ru_RU, en_US ... ).
+- Currency codes (USD, RUB ... ).
- Binary representation of hashes (`FixedString(16)` for MD5, `FixedString(32)` for SHA256).
To store UUID values, use the [UUID](../../sql-reference/data-types/uuid.md) data type.
diff --git a/docs/en/sql-reference/data-types/nested-data-structures/index.md b/docs/en/sql-reference/data-types/nested-data-structures/index.md
index d118170cd39..579ee9bfa8b 100644
--- a/docs/en/sql-reference/data-types/nested-data-structures/index.md
+++ b/docs/en/sql-reference/data-types/nested-data-structures/index.md
@@ -6,7 +6,7 @@ sidebar_label: Nested(Name1 Type1, Name2 Type2, ...)
# Nested
-## Nested(name1 Type1, Name2 Type2, …)
+## Nested(name1 Type1, Name2 Type2, ...)
A nested data structure is like a table inside a cell. The parameters of a nested data structure – the column names and types – are specified the same way as in a [CREATE TABLE](../../../sql-reference/statements/create/table.md) query. Each table row can correspond to any number of rows in a nested data structure.
diff --git a/docs/en/sql-reference/data-types/simpleaggregatefunction.md b/docs/en/sql-reference/data-types/simpleaggregatefunction.md
index 39f8409c1e1..4fb74ac30e4 100644
--- a/docs/en/sql-reference/data-types/simpleaggregatefunction.md
+++ b/docs/en/sql-reference/data-types/simpleaggregatefunction.md
@@ -5,7 +5,7 @@ sidebar_label: SimpleAggregateFunction
---
# SimpleAggregateFunction
-`SimpleAggregateFunction(name, types_of_arguments…)` data type stores current value of the aggregate function, and does not store its full state as [`AggregateFunction`](../../sql-reference/data-types/aggregatefunction.md) does. This optimization can be applied to functions for which the following property holds: the result of applying a function `f` to a row set `S1 UNION ALL S2` can be obtained by applying `f` to parts of the row set separately, and then again applying `f` to the results: `f(S1 UNION ALL S2) = f(f(S1) UNION ALL f(S2))`. This property guarantees that partial aggregation results are enough to compute the combined one, so we do not have to store and process any extra data.
+`SimpleAggregateFunction(name, types_of_arguments...)` data type stores current value of the aggregate function, and does not store its full state as [`AggregateFunction`](../../sql-reference/data-types/aggregatefunction.md) does. This optimization can be applied to functions for which the following property holds: the result of applying a function `f` to a row set `S1 UNION ALL S2` can be obtained by applying `f` to parts of the row set separately, and then again applying `f` to the results: `f(S1 UNION ALL S2) = f(f(S1) UNION ALL f(S2))`. This property guarantees that partial aggregation results are enough to compute the combined one, so we do not have to store and process any extra data.
The common way to produce an aggregate function value is by calling the aggregate function with the [-SimpleState](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-simplestate) suffix.
diff --git a/docs/en/sql-reference/functions/arithmetic-functions.md b/docs/en/sql-reference/functions/arithmetic-functions.md
index 6d95f3dc358..e3fb1d91c05 100644
--- a/docs/en/sql-reference/functions/arithmetic-functions.md
+++ b/docs/en/sql-reference/functions/arithmetic-functions.md
@@ -77,7 +77,7 @@ Alias: `a * b` (operator)
## divide
-Calculates the quotient of two values `a` and `b`. The result type is always [Float64](../../sql-reference/data-types/float.md). Integer division is provided by the `intDiv` function.
+Calculates the quotient of two values `a` and `b`. The result type is always [Float64](../data-types/float.md). Integer division is provided by the `intDiv` function.
Division by 0 returns `inf`, `-inf`, or `nan`.
@@ -140,11 +140,75 @@ Same as `intDiv` but returns zero when dividing by zero or when dividing a minim
intDivOrZero(a, b)
```
+## isFinite
+
+Returns 1 if the Float32 or Float64 argument not infinite and not a NaN, otherwise this function returns 0.
+
+**Syntax**
+
+```sql
+isFinite(x)
+```
+
+## isInfinite
+
+Returns 1 if the Float32 or Float64 argument is infinite, otherwise this function returns 0. Note that 0 is returned for a NaN.
+
+**Syntax**
+
+```sql
+isInfinite(x)
+```
+
+## ifNotFinite
+
+Checks whether a floating point value is finite.
+
+**Syntax**
+
+```sql
+ifNotFinite(x,y)
+```
+
+**Arguments**
+
+- `x` — Value to check for infinity. [Float\*](../data-types/float.md).
+- `y` — Fallback value. [Float\*](../data-types/float.md).
+
+**Returned value**
+
+- `x` if `x` is finite.
+- `y` if `x` is not finite.
+
+**Example**
+
+Query:
+
+ SELECT 1/0 as infimum, ifNotFinite(infimum,42)
+
+Result:
+
+ ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐
+ │ inf │ 42 │
+ └─────────┴───────────────────────────────┘
+
+You can get similar result by using the [ternary operator](../../sql-reference/functions/conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`.
+
+## isNaN
+
+Returns 1 if the Float32 and Float64 argument is NaN, otherwise this function 0.
+
+**Syntax**
+
+```sql
+isNaN(x)
+```
+
## modulo
Calculates the remainder of the division of two values `a` by `b`.
-The result type is an integer if both inputs are integers. If one of the inputs is a floating-point number, the result type is [Float64](../../sql-reference/data-types/float.md).
+The result type is an integer if both inputs are integers. If one of the inputs is a floating-point number, the result type is [Float64](../data-types/float.md).
The remainder is computed like in C++. Truncated division is used for negative numbers.
@@ -248,7 +312,7 @@ lcm(a, b)
## max2
-Returns the bigger of two values `a` and `b`. The returned value is of type [Float64](../../sql-reference/data-types/float.md).
+Returns the bigger of two values `a` and `b`. The returned value is of type [Float64](../data-types/float.md).
**Syntax**
@@ -274,7 +338,7 @@ Result:
## min2
-Returns the smaller of two values `a` and `b`. The returned value is of type [Float64](../../sql-reference/data-types/float.md).
+Returns the smaller of two values `a` and `b`. The returned value is of type [Float64](../data-types/float.md).
**Syntax**
@@ -300,7 +364,7 @@ Result:
## multiplyDecimal
-Multiplies two decimals `a` and `b`. The result value will be of type [Decimal256](../../sql-reference/data-types/decimal.md).
+Multiplies two decimals `a` and `b`. The result value will be of type [Decimal256](../data-types/decimal.md).
The scale of the result can be explicitly specified by `result_scale`. If `result_scale` is not specified, it is assumed to be the maximum scale of the input values.
@@ -314,15 +378,13 @@ multiplyDecimal(a, b[, result_scale])
**Arguments**
-- `a` — First value: [Decimal](../../sql-reference/data-types/decimal.md).
-- `b` — Second value: [Decimal](../../sql-reference/data-types/decimal.md).
-- `result_scale` — Scale of result: [Int/UInt](../../sql-reference/data-types/int-uint.md).
+- `a` — First value. [Decimal](../data-types/decimal.md).
+- `b` — Second value. [Decimal](../data-types/decimal.md).
+- `result_scale` — Scale of result. [Int/UInt](../data-types/int-uint.md).
**Returned value**
-- The result of multiplication with given scale.
-
-Type: [Decimal256](../../sql-reference/data-types/decimal.md).
+- The result of multiplication with given scale. [Decimal256](../data-types/decimal.md).
**Example**
@@ -376,7 +438,7 @@ Code: 407. DB::Exception: Received from localhost:9000. DB::Exception: Decimal m
## divideDecimal
-Divides two decimals `a` and `b`. The result value will be of type [Decimal256](../../sql-reference/data-types/decimal.md).
+Divides two decimals `a` and `b`. The result value will be of type [Decimal256](../data-types/decimal.md).
The scale of the result can be explicitly specified by `result_scale`. If `result_scale` is not specified, it is assumed to be the maximum scale of the input values.
@@ -390,15 +452,13 @@ divideDecimal(a, b[, result_scale])
**Arguments**
-- `a` — First value: [Decimal](../../sql-reference/data-types/decimal.md).
-- `b` — Second value: [Decimal](../../sql-reference/data-types/decimal.md).
-- `result_scale` — Scale of result: [Int/UInt](../../sql-reference/data-types/int-uint.md).
+- `a` — First value: [Decimal](../data-types/decimal.md).
+- `b` — Second value: [Decimal](../data-types/decimal.md).
+- `result_scale` — Scale of result: [Int/UInt](../data-types/int-uint.md).
**Returned value**
-- The result of division with given scale.
-
-Type: [Decimal256](../../sql-reference/data-types/decimal.md).
+- The result of division with given scale. [Decimal256](../data-types/decimal.md).
**Example**
diff --git a/docs/en/sql-reference/functions/array-functions.md b/docs/en/sql-reference/functions/array-functions.md
index 87e733a4b0c..7b52fbff714 100644
--- a/docs/en/sql-reference/functions/array-functions.md
+++ b/docs/en/sql-reference/functions/array-functions.md
@@ -19,7 +19,7 @@ empty([x])
An array is considered empty if it does not contain any elements.
:::note
-Can be optimized by enabling the [`optimize_functions_to_subcolumns` setting](../../operations/settings/settings.md#optimize-functions-to-subcolumns). With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../../sql-reference/data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT empty(arr) FROM TABLE;` transforms to `SELECT arr.size0 = 0 FROM TABLE;`.
+Can be optimized by enabling the [`optimize_functions_to_subcolumns` setting](../../operations/settings/settings.md#optimize-functions-to-subcolumns). With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT empty(arr) FROM TABLE;` transforms to `SELECT arr.size0 = 0 FROM TABLE;`.
:::
The function also works for [strings](string-functions.md#empty) or [UUID](uuid-functions.md#empty).
@@ -30,9 +30,7 @@ The function also works for [strings](string-functions.md#empty) or [UUID](uuid-
**Returned value**
-- Returns `1` for an empty array or `0` for a non-empty array.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for an empty array or `0` for a non-empty array. [UInt8](../data-types/int-uint.md).
**Example**
@@ -63,7 +61,7 @@ notEmpty([x])
An array is considered non-empty if it contains at least one element.
:::note
-Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../../sql-reference/data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT notEmpty(arr) FROM table` transforms to `SELECT arr.size0 != 0 FROM TABLE`.
+Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT notEmpty(arr) FROM table` transforms to `SELECT arr.size0 != 0 FROM TABLE`.
:::
The function also works for [strings](string-functions.md#notempty) or [UUID](uuid-functions.md#notempty).
@@ -74,9 +72,7 @@ The function also works for [strings](string-functions.md#notempty) or [UUID](uu
**Returned value**
-- Returns `1` for a non-empty array or `0` for an empty array.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for a non-empty array or `0` for an empty array. [UInt8](../data-types/int-uint.md).
**Example**
@@ -100,7 +96,7 @@ Returns the number of items in the array.
The result type is UInt64.
The function also works for strings.
-Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../../sql-reference/data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT length(arr) FROM table` transforms to `SELECT arr.size0 FROM TABLE`.
+Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [size0](../data-types/array.md#array-size) subcolumn instead of reading and processing the whole array column. The query `SELECT length(arr) FROM table` transforms to `SELECT arr.size0 FROM TABLE`.
Alias: `OCTET_LENGTH`
@@ -561,7 +557,7 @@ Result:
└─────────────┴─────────────┴────────────────┴─────────────────┘
```
-## array(x1, …), operator \[x1, …\]
+## array(x1, ...), operator \[x1, ...\]
Creates an array from the function arguments.
The arguments must be constants and have types that have the smallest common type. At least one argument must be passed, because otherwise it isn’t clear which type of array to create. That is, you can’t use this function to create an empty array (to do that, use the ‘emptyArray\*’ function described above).
@@ -581,7 +577,7 @@ arrayConcat(arrays)
**Arguments**
-- `arrays` – Arbitrary number of arguments of [Array](../../sql-reference/data-types/array.md) type.
+- `arrays` – Arbitrary number of arguments of [Array](../data-types/array.md) type.
**Example**
@@ -768,9 +764,9 @@ SELECT indexOf([1, 3, NULL, NULL], NULL)
Elements set to `NULL` are handled as normal values.
-## arrayCount(\[func,\] arr1, …)
+## arrayCount(\[func,\] arr1, ...)
-Returns the number of elements for which `func(arr1[i], …, arrN[i])` returns something other than 0. If `func` is not specified, it returns the number of non-zero elements in the array.
+Returns the number of elements for which `func(arr1[i], ..., arrN[i])` returns something other than 0. If `func` is not specified, it returns the number of non-zero elements in the array.
Note that the `arrayCount` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You can pass a lambda function to it as the first argument.
@@ -797,9 +793,11 @@ The sizes of the two vectors must be equal. Arrays and Tuples may also contain m
**Returned value**
-- The dot product of the two vectors.
+- The dot product of the two vectors. [Numeric](https://clickhouse.com/docs/en/native-protocol/columns#numeric-types).
-Type: numeric - determined by the type of the arguments. If Arrays or Tuples contain mixed element types then the result type is the supertype.
+:::note
+The return type is determined by the type of the arguments. If Arrays or Tuples contain mixed element types then the result type is the supertype.
+:::
**Examples**
@@ -847,7 +845,7 @@ SELECT countEqual([1, 2, NULL, NULL], NULL)
## arrayEnumerate(arr)
-Returns the array \[1, 2, 3, …, length (arr) \]
+Returns the array \[1, 2, 3, ..., length (arr) \]
This function is normally used with ARRAY JOIN. It allows counting something just once for each array after applying ARRAY JOIN. Example:
@@ -887,7 +885,7 @@ WHERE (CounterID = 160656) AND notEmpty(GoalsReached)
This function can also be used in higher-order functions. For example, you can use it to get array indexes for elements that match a condition.
-## arrayEnumerateUniq(arr, …)
+## arrayEnumerateUniq(arr, ...)
Returns an array the same size as the source array, indicating for each element what its position is among elements with the same value.
For example: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\].
@@ -1060,7 +1058,7 @@ arrayPushBack(array, single_value)
**Arguments**
- `array` – Array.
-- `single_value` – A single value. Only numbers can be added to an array with numbers, and only strings can be added to an array of strings. When adding numbers, ClickHouse automatically sets the `single_value` type for the data type of the array. For more information about the types of data in ClickHouse, see “[Data types](../../sql-reference/data-types/index.md#data_types)”. Can be `NULL`. The function adds a `NULL` element to an array, and the type of array elements converts to `Nullable`.
+- `single_value` – A single value. Only numbers can be added to an array with numbers, and only strings can be added to an array of strings. When adding numbers, ClickHouse automatically sets the `single_value` type for the data type of the array. For more information about the types of data in ClickHouse, see “[Data types](../data-types/index.md#data_types)”. Can be `NULL`. The function adds a `NULL` element to an array, and the type of array elements converts to `Nullable`.
**Example**
@@ -1085,7 +1083,7 @@ arrayPushFront(array, single_value)
**Arguments**
- `array` – Array.
-- `single_value` – A single value. Only numbers can be added to an array with numbers, and only strings can be added to an array of strings. When adding numbers, ClickHouse automatically sets the `single_value` type for the data type of the array. For more information about the types of data in ClickHouse, see “[Data types](../../sql-reference/data-types/index.md#data_types)”. Can be `NULL`. The function adds a `NULL` element to an array, and the type of array elements converts to `Nullable`.
+- `single_value` – A single value. Only numbers can be added to an array with numbers, and only strings can be added to an array of strings. When adding numbers, ClickHouse automatically sets the `single_value` type for the data type of the array. For more information about the types of data in ClickHouse, see “[Data types](../data-types/index.md#data_types)”. Can be `NULL`. The function adds a `NULL` element to an array, and the type of array elements converts to `Nullable`.
**Example**
@@ -1181,14 +1179,12 @@ arrayShingles(array, length)
**Arguments**
-- `array` — Input array [Array](../../sql-reference/data-types/array.md).
+- `array` — Input array [Array](../data-types/array.md).
- `length` — The length of each shingle.
**Returned value**
-- An array of generated shingles.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- An array of generated shingles. [Array](../data-types/array.md).
**Examples**
@@ -1206,7 +1202,7 @@ Result:
└───────────────────┘
```
-## arraySort(\[func,\] arr, …) {#sort}
+## arraySort(\[func,\] arr, ...) {#sort}
Sorts the elements of the `arr` array in ascending order. If the `func` function is specified, sorting order is determined by the result of the `func` function applied to the elements of the array. If `func` accepts multiple arguments, the `arraySort` function is passed several arrays that the arguments of `func` will correspond to. Detailed examples are shown at the end of `arraySort` description.
@@ -1307,11 +1303,11 @@ SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res;
To improve sorting efficiency, the [Schwartzian transform](https://en.wikipedia.org/wiki/Schwartzian_transform) is used.
:::
-## arrayPartialSort(\[func,\] limit, arr, …)
+## arrayPartialSort(\[func,\] limit, arr, ...)
Same as `arraySort` with additional `limit` argument allowing partial sorting. Returns an array of the same size as the original array where elements in range `[1..limit]` are sorted in ascending order. Remaining elements `(limit..N]` shall contain elements in unspecified order.
-## arrayReverseSort(\[func,\] arr, …) {#reverse-sort}
+## arrayReverseSort(\[func,\] arr, ...) {#reverse-sort}
Sorts the elements of the `arr` array in descending order. If the `func` function is specified, `arr` is sorted according to the result of the `func` function applied to the elements of the array, and then the sorted array is reversed. If `func` accepts multiple arguments, the `arrayReverseSort` function is passed several arrays that the arguments of `func` will correspond to. Detailed examples are shown at the end of `arrayReverseSort` description.
@@ -1412,7 +1408,7 @@ SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res;
└─────────┘
```
-## arrayPartialReverseSort(\[func,\] limit, arr, …)
+## arrayPartialReverseSort(\[func,\] limit, arr, ...)
Same as `arrayReverseSort` with additional `limit` argument allowing partial sorting. Returns an array of the same size as the original array where elements in range `[1..limit]` are sorted in descending order. Remaining elements `(limit..N]` shall contain elements in unspecified order.
@@ -1535,7 +1531,7 @@ Result:
[3,9,1,4,5,6,7,8,2,10]
```
-## arrayUniq(arr, …)
+## arrayUniq(arr, ...)
If one argument is passed, it counts the number of different elements in the array.
If multiple arguments are passed, it counts the number of different tuples of elements at corresponding positions in multiple arrays.
@@ -1562,9 +1558,7 @@ arrayDifference(array)
**Returned values**
-Returns an array of differences between adjacent array elements.
-
-Type: [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
+Returns an array of differences between adjacent array elements. [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
**Example**
@@ -1766,8 +1760,8 @@ arrayReduce(agg_func, arr1, arr2, ..., arrN)
**Arguments**
-- `agg_func` — The name of an aggregate function which should be a constant [string](../../sql-reference/data-types/string.md).
-- `arr` — Any number of [array](../../sql-reference/data-types/array.md) type columns as the parameters of the aggregation function.
+- `agg_func` — The name of an aggregate function which should be a constant [string](../data-types/string.md).
+- `arr` — Any number of [array](../data-types/array.md) type columns as the parameters of the aggregation function.
**Returned value**
@@ -1835,15 +1829,13 @@ arrayReduceInRanges(agg_func, ranges, arr1, arr2, ..., arrN)
**Arguments**
-- `agg_func` — The name of an aggregate function which should be a constant [string](../../sql-reference/data-types/string.md).
-- `ranges` — The ranges to aggretate which should be an [array](../../sql-reference/data-types/array.md) of [tuples](../../sql-reference/data-types/tuple.md) which containing the index and the length of each range.
-- `arr` — Any number of [Array](../../sql-reference/data-types/array.md) type columns as the parameters of the aggregation function.
+- `agg_func` — The name of an aggregate function which should be a constant [string](../data-types/string.md).
+- `ranges` — The ranges to aggretate which should be an [array](../data-types/array.md) of [tuples](../data-types/tuple.md) which containing the index and the length of each range.
+- `arr` — Any number of [Array](../data-types/array.md) type columns as the parameters of the aggregation function.
**Returned value**
-- Array containing results of the aggregate function over specified ranges.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- Array containing results of the aggregate function over specified ranges. [Array](../data-types/array.md).
**Example**
@@ -1956,7 +1948,7 @@ Alias: `flatten`.
**Parameters**
-- `array_of_arrays` — [Array](../../sql-reference/data-types/array.md) of arrays. For example, `[[1,2,3], [4,5]]`.
+- `array_of_arrays` — [Array](../data-types/array.md) of arrays. For example, `[[1,2,3], [4,5]]`.
**Examples**
@@ -1982,13 +1974,11 @@ arrayCompact(arr)
**Arguments**
-`arr` — The [array](../../sql-reference/data-types/array.md) to inspect.
+`arr` — The [array](../data-types/array.md) to inspect.
**Returned value**
-The array without duplicate.
-
-Type: `Array`.
+The array without duplicate. [Array](../data-types/array.md).
**Example**
@@ -2018,15 +2008,13 @@ arrayZip(arr1, arr2, ..., arrN)
**Arguments**
-- `arrN` — [Array](../../sql-reference/data-types/array.md).
+- `arrN` — [Array](../data-types/array.md).
The function can take any number of arrays of different types. All the input arrays must be of equal size.
**Returned value**
-- Array with elements from the source arrays grouped into [tuples](../../sql-reference/data-types/tuple.md). Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- Array with elements from the source arrays grouped into [tuples](../data-types/tuple.md). Data types in the tuple are the same as types of the input arrays and in the same order as arrays are passed. [Array](../data-types/array.md).
**Example**
@@ -2079,9 +2067,9 @@ Result:
└───────────────────────────────────────────────┘
```
-## arrayMap(func, arr1, …)
+## arrayMap(func, arr1, ...)
-Returns an array obtained from the original arrays by application of `func(arr1[i], …, arrN[i])` for each element. Arrays `arr1` … `arrN` must have the same number of elements.
+Returns an array obtained from the original arrays by application of `func(arr1[i], ..., arrN[i])` for each element. Arrays `arr1` ... `arrN` must have the same number of elements.
Examples:
@@ -2109,9 +2097,9 @@ SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res
Note that the `arrayMap` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayFilter(func, arr1, …)
+## arrayFilter(func, arr1, ...)
-Returns an array containing only the elements in `arr1` for which `func(arr1[i], …, arrN[i])` returns something other than 0.
+Returns an array containing only the elements in `arr1` for which `func(arr1[i], ..., arrN[i])` returns something other than 0.
Examples:
@@ -2142,9 +2130,9 @@ SELECT
Note that the `arrayFilter` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayFill(func, arr1, …)
+## arrayFill(func, arr1, ...)
-Scan through `arr1` from the first element to the last element and replace `arr1[i]` by `arr1[i - 1]` if `func(arr1[i], …, arrN[i])` returns 0. The first element of `arr1` will not be replaced.
+Scan through `arr1` from the first element to the last element and replace `arr1[i]` by `arr1[i - 1]` if `func(arr1[i], ..., arrN[i])` returns 0. The first element of `arr1` will not be replaced.
Examples:
@@ -2160,9 +2148,9 @@ SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14,
Note that the `arrayFill` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayReverseFill(func, arr1, …)
+## arrayReverseFill(func, arr1, ...)
-Scan through `arr1` from the last element to the first element and replace `arr1[i]` by `arr1[i + 1]` if `func(arr1[i], …, arrN[i])` returns 0. The last element of `arr1` will not be replaced.
+Scan through `arr1` from the last element to the first element and replace `arr1[i]` by `arr1[i + 1]` if `func(arr1[i], ..., arrN[i])` returns 0. The last element of `arr1` will not be replaced.
Examples:
@@ -2178,9 +2166,9 @@ SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5,
Note that the `arrayReverseFill` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arraySplit(func, arr1, …)
+## arraySplit(func, arr1, ...)
-Split `arr1` into multiple arrays. When `func(arr1[i], …, arrN[i])` returns something other than 0, the array will be split on the left hand side of the element. The array will not be split before the first element.
+Split `arr1` into multiple arrays. When `func(arr1[i], ..., arrN[i])` returns something other than 0, the array will be split on the left hand side of the element. The array will not be split before the first element.
Examples:
@@ -2196,9 +2184,9 @@ SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
Note that the `arraySplit` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayReverseSplit(func, arr1, …)
+## arrayReverseSplit(func, arr1, ...)
-Split `arr1` into multiple arrays. When `func(arr1[i], …, arrN[i])` returns something other than 0, the array will be split on the right hand side of the element. The array will not be split after the last element.
+Split `arr1` into multiple arrays. When `func(arr1[i], ..., arrN[i])` returns something other than 0, the array will be split on the right hand side of the element. The array will not be split after the last element.
Examples:
@@ -2214,30 +2202,30 @@ SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
Note that the `arrayReverseSplit` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayExists(\[func,\] arr1, …)
+## arrayExists(\[func,\] arr1, ...)
-Returns 1 if there is at least one element in `arr` for which `func(arr1[i], …, arrN[i])` returns something other than 0. Otherwise, it returns 0.
+Returns 1 if there is at least one element in `arr` for which `func(arr1[i], ..., arrN[i])` returns something other than 0. Otherwise, it returns 0.
Note that the `arrayExists` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You can pass a lambda function to it as the first argument.
-## arrayAll(\[func,\] arr1, …)
+## arrayAll(\[func,\] arr1, ...)
-Returns 1 if `func(arr1[i], …, arrN[i])` returns something other than 0 for all the elements in arrays. Otherwise, it returns 0.
+Returns 1 if `func(arr1[i], ..., arrN[i])` returns something other than 0 for all the elements in arrays. Otherwise, it returns 0.
Note that the `arrayAll` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You can pass a lambda function to it as the first argument.
-## arrayFirst(func, arr1, …)
+## arrayFirst(func, arr1, ...)
-Returns the first element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0.
+Returns the first element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0.
## arrayFirstOrNull
-Returns the first element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0, otherwise it returns `NULL`.
+Returns the first element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0, otherwise it returns `NULL`.
**Syntax**
```sql
-arrayFirstOrNull(func, arr1, …)
+arrayFirstOrNull(func, arr1, ...)
```
**Parameters**
@@ -2292,20 +2280,20 @@ Result:
\N
```
-## arrayLast(func, arr1, …)
+## arrayLast(func, arr1, ...)
-Returns the last element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0.
+Returns the last element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0.
Note that the `arrayLast` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
## arrayLastOrNull
-Returns the last element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0, otherwise returns `NULL`.
+Returns the last element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0, otherwise returns `NULL`.
**Syntax**
```sql
-arrayLastOrNull(func, arr1, …)
+arrayLastOrNull(func, arr1, ...)
```
**Parameters**
@@ -2348,15 +2336,15 @@ Result:
\N
```
-## arrayFirstIndex(func, arr1, …)
+## arrayFirstIndex(func, arr1, ...)
-Returns the index of the first element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0.
+Returns the index of the first element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0.
Note that the `arrayFirstIndex` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
-## arrayLastIndex(func, arr1, …)
+## arrayLastIndex(func, arr1, ...)
-Returns the index of the last element in the `arr1` array for which `func(arr1[i], …, arrN[i])` returns something other than 0.
+Returns the index of the last element in the `arr1` array for which `func(arr1[i], ..., arrN[i])` returns something other than 0.
Note that the `arrayLastIndex` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You must pass a lambda function to it as the first argument, and it can’t be omitted.
@@ -2376,14 +2364,16 @@ arrayMin([func,] arr)
**Arguments**
-- `func` — Function. [Expression](../../sql-reference/data-types/special-data-types/expression.md).
-- `arr` — Array. [Array](../../sql-reference/data-types/array.md).
+- `func` — Function. [Expression](../data-types/special-data-types/expression.md).
+- `arr` — Array. [Array](../data-types/array.md).
**Returned value**
- The minimum of function values (or the array minimum).
-Type: if `func` is specified, matches `func` return value type, else matches the array elements type.
+:::note
+If `func` is specified, then the return type matches the return value type of `func`, otherwise it matches the type of the array elements.
+:::
**Examples**
@@ -2431,14 +2421,16 @@ arrayMax([func,] arr)
**Arguments**
-- `func` — Function. [Expression](../../sql-reference/data-types/special-data-types/expression.md).
-- `arr` — Array. [Array](../../sql-reference/data-types/array.md).
+- `func` — Function. [Expression](../data-types/special-data-types/expression.md).
+- `arr` — Array. [Array](../data-types/array.md).
**Returned value**
- The maximum of function values (or the array maximum).
-Type: if `func` is specified, matches `func` return value type, else matches the array elements type.
+:::note
+if `func` is specified then the return type matches the return value type of `func`, otherwise it matches the type of the array elements.
+:::
**Examples**
@@ -2486,14 +2478,21 @@ arraySum([func,] arr)
**Arguments**
-- `func` — Function. [Expression](../../sql-reference/data-types/special-data-types/expression.md).
-- `arr` — Array. [Array](../../sql-reference/data-types/array.md).
+- `func` — Function. [Expression](../data-types/special-data-types/expression.md).
+- `arr` — Array. [Array](../data-types/array.md).
**Returned value**
- The sum of the function values (or the array sum).
-Type: for decimal numbers in source array (or for converted values, if `func` is specified) — [Decimal128](../../sql-reference/data-types/decimal.md), for floating point numbers — [Float64](../../sql-reference/data-types/float.md), for numeric unsigned — [UInt64](../../sql-reference/data-types/int-uint.md), and for numeric signed — [Int64](../../sql-reference/data-types/int-uint.md).
+:::note
+Return type:
+
+- For decimal numbers in the source array (or for converted values, if `func` is specified) — [Decimal128](../data-types/decimal.md).
+- For floating point numbers — [Float64](../data-types/float.md).
+- For numeric unsigned — [UInt64](../data-types/int-uint.md).
+- For numeric signed — [Int64](../data-types/int-uint.md).
+:::
**Examples**
@@ -2541,14 +2540,12 @@ arrayAvg([func,] arr)
**Arguments**
-- `func` — Function. [Expression](../../sql-reference/data-types/special-data-types/expression.md).
-- `arr` — Array. [Array](../../sql-reference/data-types/array.md).
+- `func` — Function. [Expression](../data-types/special-data-types/expression.md).
+- `arr` — Array. [Array](../data-types/array.md).
**Returned value**
-- The average of function values (or the array average).
-
-Type: [Float64](../../sql-reference/data-types/float.md).
+- The average of function values (or the array average). [Float64](../data-types/float.md).
**Examples**
@@ -2580,9 +2577,9 @@ Result:
└─────┘
```
-## arrayCumSum(\[func,\] arr1, …)
+## arrayCumSum(\[func,\] arr1, ...)
-Returns an array of the partial (running) sums of the elements in the source array `arr1`. If `func` is specified, then the sum is computed from applying `func` to `arr1`, `arr2`, ..., `arrN`, i.e. `func(arr1[i], …, arrN[i])`.
+Returns an array of the partial (running) sums of the elements in the source array `arr1`. If `func` is specified, then the sum is computed from applying `func` to `arr1`, `arr2`, ..., `arrN`, i.e. `func(arr1[i], ..., arrN[i])`.
**Syntax**
@@ -2592,13 +2589,11 @@ arrayCumSum(arr)
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md) of numeric values.
+- `arr` — [Array](../data-types/array.md) of numeric values.
**Returned value**
-- Returns an array of the partial sums of the elements in the source array.
-
-Type: [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
+- Returns an array of the partial sums of the elements in the source array. [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
Example:
@@ -2614,9 +2609,9 @@ SELECT arrayCumSum([1, 1, 1, 1]) AS res
Note that the `arrayCumSum` is a [higher-order function](../../sql-reference/functions/index.md#higher-order-functions). You can pass a lambda function to it as the first argument.
-## arrayCumSumNonNegative(\[func,\] arr1, …)
+## arrayCumSumNonNegative(\[func,\] arr1, ...)
-Same as `arrayCumSum`, returns an array of the partial (running) sums of the elements in the source array. If `func` is specified, then the sum is computed from applying `func` to `arr1`, `arr2`, ..., `arrN`, i.e. `func(arr1[i], …, arrN[i])`. Unlike `arrayCumSum`, if the current running sum is smaller than `0`, it is replaced by `0`.
+Same as `arrayCumSum`, returns an array of the partial (running) sums of the elements in the source array. If `func` is specified, then the sum is computed from applying `func` to `arr1`, `arr2`, ..., `arrN`, i.e. `func(arr1[i], ..., arrN[i])`. Unlike `arrayCumSum`, if the current running sum is smaller than `0`, it is replaced by `0`.
**Syntax**
@@ -2626,13 +2621,11 @@ arrayCumSumNonNegative(arr)
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md) of numeric values.
+- `arr` — [Array](../data-types/array.md) of numeric values.
**Returned value**
-- Returns an array of non-negative partial sums of elements in the source array.
-
-Type: [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
+- Returns an array of non-negative partial sums of elements in the source array. [UInt\*](https://clickhouse.com/docs/en/data_types/int_uint/#uint-ranges), [Int\*](https://clickhouse.com/docs/en/data_types/int_uint/#int-ranges), [Float\*](https://clickhouse.com/docs/en/data_types/float/).
``` sql
SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res
@@ -2648,7 +2641,7 @@ Note that the `arraySumNonNegative` is a [higher-order function](../../sql-refer
## arrayProduct
-Multiplies elements of an [array](../../sql-reference/data-types/array.md).
+Multiplies elements of an [array](../data-types/array.md).
**Syntax**
@@ -2658,13 +2651,11 @@ arrayProduct(arr)
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md) of numeric values.
+- `arr` — [Array](../data-types/array.md) of numeric values.
**Returned value**
-- A product of array's elements.
-
-Type: [Float64](../../sql-reference/data-types/float.md).
+- A product of array's elements. [Float64](../data-types/float.md).
**Examples**
@@ -2688,7 +2679,7 @@ Query:
SELECT arrayProduct([toDecimal64(1,8), toDecimal64(2,8), toDecimal64(3,8)]) as res, toTypeName(res);
```
-Return value type is always [Float64](../../sql-reference/data-types/float.md). Result:
+Return value type is always [Float64](../data-types/float.md). Result:
``` text
┌─res─┬─toTypeName(arrayProduct(array(toDecimal64(1, 8), toDecimal64(2, 8), toDecimal64(3, 8))))─┐
@@ -2698,7 +2689,7 @@ Return value type is always [Float64](../../sql-reference/data-types/float.md).
## arrayRotateLeft
-Rotates an [array](../../sql-reference/data-types/array.md) to the left by the specified number of elements.
+Rotates an [array](../data-types/array.md) to the left by the specified number of elements.
If the number of elements is negative, the array is rotated to the right.
**Syntax**
@@ -2709,14 +2700,12 @@ arrayRotateLeft(arr, n)
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md).
+- `arr` — [Array](../data-types/array.md).
- `n` — Number of elements to rotate.
**Returned value**
-- An array rotated to the left by the specified number of elements.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- An array rotated to the left by the specified number of elements. [Array](../data-types/array.md).
**Examples**
@@ -2764,7 +2753,7 @@ Result:
## arrayRotateRight
-Rotates an [array](../../sql-reference/data-types/array.md) to the right by the specified number of elements.
+Rotates an [array](../data-types/array.md) to the right by the specified number of elements.
If the number of elements is negative, the array is rotated to the left.
**Syntax**
@@ -2775,14 +2764,12 @@ arrayRotateRight(arr, n)
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md).
+- `arr` — [Array](../data-types/array.md).
- `n` — Number of elements to rotate.
**Returned value**
-- An array rotated to the right by the specified number of elements.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- An array rotated to the right by the specified number of elements. [Array](../data-types/array.md).
**Examples**
@@ -2830,7 +2817,7 @@ Result:
## arrayShiftLeft
-Shifts an [array](../../sql-reference/data-types/array.md) to the left by the specified number of elements.
+Shifts an [array](../data-types/array.md) to the left by the specified number of elements.
New elements are filled with the provided argument or the default value of the array element type.
If the number of elements is negative, the array is shifted to the right.
@@ -2842,15 +2829,13 @@ arrayShiftLeft(arr, n[, default])
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md).
+- `arr` — [Array](../data-types/array.md).
- `n` — Number of elements to shift.
- `default` — Optional. Default value for new elements.
**Returned value**
-- An array shifted to the left by the specified number of elements.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- An array shifted to the left by the specified number of elements. [Array](../data-types/array.md).
**Examples**
@@ -2926,7 +2911,7 @@ Result:
## arrayShiftRight
-Shifts an [array](../../sql-reference/data-types/array.md) to the right by the specified number of elements.
+Shifts an [array](../data-types/array.md) to the right by the specified number of elements.
New elements are filled with the provided argument or the default value of the array element type.
If the number of elements is negative, the array is shifted to the left.
@@ -2938,15 +2923,13 @@ arrayShiftRight(arr, n[, default])
**Arguments**
-- `arr` — [Array](../../sql-reference/data-types/array.md).
+- `arr` — [Array](../data-types/array.md).
- `n` — Number of elements to shift.
- `default` — Optional. Default value for new elements.
**Returned value**
-- An array shifted to the right by the specified number of elements.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- An array shifted to the right by the specified number of elements. [Array](../data-types/array.md).
**Examples**
@@ -3038,9 +3021,7 @@ arrayRandomSample(arr, samples)
**Returned Value**
-- An array containing a random sample of elements from the input array.
-
-Type: [Array](../data-types/array.md).
+- An array containing a random sample of elements from the input array. [Array](../data-types/array.md).
**Examples**
diff --git a/docs/en/sql-reference/functions/bit-functions.md b/docs/en/sql-reference/functions/bit-functions.md
index 0951c783aae..a48893b93bf 100644
--- a/docs/en/sql-reference/functions/bit-functions.md
+++ b/docs/en/sql-reference/functions/bit-functions.md
@@ -34,8 +34,8 @@ bitShiftLeft(a, b)
**Arguments**
-- `a` — A value to shift. [Integer types](../../sql-reference/data-types/int-uint.md), [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `b` — The number of shift positions. [Unsigned integer types](../../sql-reference/data-types/int-uint.md), 64 bit types or less are allowed.
+- `a` — A value to shift. [Integer types](../data-types/int-uint.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `b` — The number of shift positions. [Unsigned integer types](../data-types/int-uint.md), 64 bit types or less are allowed.
**Returned value**
@@ -81,8 +81,8 @@ bitShiftRight(a, b)
**Arguments**
-- `a` — A value to shift. [Integer types](../../sql-reference/data-types/int-uint.md), [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `b` — The number of shift positions. [Unsigned integer types](../../sql-reference/data-types/int-uint.md), 64 bit types or less are allowed.
+- `a` — A value to shift. [Integer types](../data-types/int-uint.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `b` — The number of shift positions. [Unsigned integer types](../data-types/int-uint.md), 64 bit types or less are allowed.
**Returned value**
@@ -131,13 +131,13 @@ bitSlice(s, offset[, length])
**Arguments**
-- `s` — s is [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `s` — s is [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
- `offset` — The start index with bit, A positive value indicates an offset on the left, and a negative value is an indent on the right. Numbering of the bits begins with 1.
- `length` — The length of substring with bit. If you specify a negative value, the function returns an open substring \[offset, array_length - length\]. If you omit the value, the function returns the substring \[offset, the_end_string\]. If length exceeds s, it will be truncate.If length isn't multiple of 8, will fill 0 on the right.
**Returned value**
-- The substring. [String](../../sql-reference/data-types/string.md)
+- The substring. [String](../data-types/string.md)
**Example**
@@ -186,11 +186,9 @@ SELECT bitTest(number, index)
- `number` – Integer number.
- `index` – Position of bit.
-**Returned values**
+**Returned value**
-Returns a value of bit at specified position.
-
-Type: `UInt8`.
+- Value of the bit at the specified position. [UInt8](../data-types/int-uint.md).
**Example**
@@ -251,11 +249,9 @@ SELECT bitTestAll(number, index1, index2, index3, index4, ...)
- `number` – Integer number.
- `index1`, `index2`, `index3`, `index4` – Positions of bit. For example, for set of positions (`index1`, `index2`, `index3`, `index4`) is true if and only if all of its positions are true (`index1` ⋀ `index2`, ⋀ `index3` ⋀ `index4`).
-**Returned values**
+**Returned value**
-Returns result of logical conjuction.
-
-Type: `UInt8`.
+- Result of the logical conjuction. [UInt8](../data-types/int-uint.md).
**Example**
@@ -316,11 +312,9 @@ SELECT bitTestAny(number, index1, index2, index3, index4, ...)
- `number` – Integer number.
- `index1`, `index2`, `index3`, `index4` – Positions of bit.
-**Returned values**
+**Returned value**
-Returns result of logical disjunction.
-
-Type: `UInt8`.
+- Result of the logical disjunction. [UInt8](../data-types/int-uint.md).
**Example**
@@ -368,15 +362,15 @@ bitCount(x)
**Arguments**
-- `x` — [Integer](../../sql-reference/data-types/int-uint.md) or [floating-point](../../sql-reference/data-types/float.md) number. The function uses the value representation in memory. It allows supporting floating-point numbers.
+- `x` — [Integer](../data-types/int-uint.md) or [floating-point](../data-types/float.md) number. The function uses the value representation in memory. It allows supporting floating-point numbers.
**Returned value**
-- Number of bits set to one in the input number.
+- Number of bits set to one in the input number. [UInt8](../data-types/int-uint.md).
-The function does not convert input value to a larger type ([sign extension](https://en.wikipedia.org/wiki/Sign_extension)). So, for example, `bitCount(toUInt8(-1)) = 8`.
-
-Type: `UInt8`.
+:::note
+The function does not convert the input value to a larger type ([sign extension](https://en.wikipedia.org/wiki/Sign_extension)). So, for example, `bitCount(toUInt8(-1)) = 8`.
+:::
**Example**
@@ -408,14 +402,12 @@ bitHammingDistance(int1, int2)
**Arguments**
-- `int1` — First integer value. [Int64](../../sql-reference/data-types/int-uint.md).
-- `int2` — Second integer value. [Int64](../../sql-reference/data-types/int-uint.md).
+- `int1` — First integer value. [Int64](../data-types/int-uint.md).
+- `int2` — Second integer value. [Int64](../data-types/int-uint.md).
**Returned value**
-- The Hamming distance.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- The Hamming distance. [UInt8](../data-types/int-uint.md).
**Examples**
diff --git a/docs/en/sql-reference/functions/bitmap-functions.md b/docs/en/sql-reference/functions/bitmap-functions.md
index 379be302881..a5c8a663b71 100644
--- a/docs/en/sql-reference/functions/bitmap-functions.md
+++ b/docs/en/sql-reference/functions/bitmap-functions.md
@@ -75,8 +75,8 @@ bitmapSubsetInRange(bitmap, range_start, range_end)
**Arguments**
- `bitmap` – [Bitmap object](#bitmap_functions-bitmapbuild).
-- `range_start` – Start of the range (inclusive). Type: [UInt32](../../sql-reference/data-types/int-uint.md).
-- `range_end` – End of the range (exclusive). Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- `range_start` – Start of the range (inclusive). [UInt32](../data-types/int-uint.md).
+- `range_end` – End of the range (exclusive). [UInt32](../data-types/int-uint.md).
**Example**
@@ -105,8 +105,8 @@ bitmapSubsetLimit(bitmap, range_start, cardinality_limit)
**Arguments**
- `bitmap` – [Bitmap object](#bitmap_functions-bitmapbuild).
-- `range_start` – Start of the range (inclusive). Type: [UInt32](../../sql-reference/data-types/int-uint.md).
-- `cardinality_limit` – Maximum cardinality of the subset. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- `range_start` – Start of the range (inclusive). [UInt32](../data-types/int-uint.md).
+- `cardinality_limit` – Maximum cardinality of the subset. [UInt32](../data-types/int-uint.md).
**Example**
@@ -134,9 +134,9 @@ subBitmap(bitmap, offset, cardinality_limit)
**Arguments**
-- `bitmap` – The bitmap. Type: [Bitmap object](#bitmap_functions-bitmapbuild).
-- `offset` – The position of the first element of the subset. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
-- `cardinality_limit` – The maximum number of elements in the subset. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- `bitmap` – The bitmap. [Bitmap object](#bitmap_functions-bitmapbuild).
+- `offset` – The position of the first element of the subset. [UInt32](../data-types/int-uint.md).
+- `cardinality_limit` – The maximum number of elements in the subset. [UInt32](../data-types/int-uint.md).
**Example**
@@ -163,14 +163,12 @@ bitmapContains(bitmap, needle)
**Arguments**
- `bitmap` – [Bitmap object](#bitmap_functions-bitmapbuild).
-- `needle` – Searched bit value. Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- `needle` – Searched bit value. [UInt32](../data-types/int-uint.md).
**Returned values**
-- 0 — If `bitmap` does not contain `needle`.
-- 1 — If `bitmap` contains `needle`.
-
-Type: `UInt8`.
+- 0 — If `bitmap` does not contain `needle`. [UInt8](../data-types/int-uint.md).
+- 1 — If `bitmap` contains `needle`. [UInt8](../data-types/int-uint.md).
**Example**
diff --git a/docs/en/sql-reference/functions/date-time-functions.md b/docs/en/sql-reference/functions/date-time-functions.md
index 843f22e5a6f..6ad26f452ad 100644
--- a/docs/en/sql-reference/functions/date-time-functions.md
+++ b/docs/en/sql-reference/functions/date-time-functions.md
@@ -26,7 +26,7 @@ SELECT
## makeDate
-Creates a [Date](../../sql-reference/data-types/date.md)
+Creates a [Date](../data-types/date.md)
- from a year, month and day argument, or
- from a year and day of year argument.
@@ -43,16 +43,14 @@ Alias:
**Arguments**
-- `year` — Year. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `month` — Month. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `day` — Day. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `day_of_year` — Day of the year. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `year` — Year. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `month` — Month. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `day` — Day. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `day_of_year` — Day of the year. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
**Returned value**
-- A date created from the arguments.
-
-Type: [Date](../../sql-reference/data-types/date.md).
+- A date created from the arguments. [Date](../data-types/date.md).
**Example**
@@ -85,11 +83,11 @@ Result:
```
## makeDate32
-Like [makeDate](#makeDate) but produces a [Date32](../../sql-reference/data-types/date32.md).
+Like [makeDate](#makeDate) but produces a [Date32](../data-types/date32.md).
## makeDateTime
-Creates a [DateTime](../../sql-reference/data-types/datetime.md) from a year, month, day, hour, minute and second argument.
+Creates a [DateTime](../data-types/datetime.md) from a year, month, day, hour, minute and second argument.
**Syntax**
@@ -99,19 +97,17 @@ makeDateTime(year, month, day, hour, minute, second[, timezone])
**Arguments**
-- `year` — Year. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `month` — Month. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `day` — Day. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `hour` — Hour. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `minute` — Minute. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
-- `second` — Second. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `year` — Year. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `month` — Month. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `day` — Day. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `hour` — Hour. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `minute` — Minute. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
+- `second` — Second. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
- `timezone` — [Timezone](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional).
**Returned value**
-- A date with time created from the arguments.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- A date with time created from the arguments. [DateTime](../data-types/datetime.md).
**Example**
@@ -129,7 +125,7 @@ Result:
## makeDateTime64
-Like [makeDateTime](#makedatetime) but produces a [DateTime64](../../sql-reference/data-types/datetime64.md).
+Like [makeDateTime](#makedatetime) but produces a [DateTime64](../data-types/datetime64.md).
**Syntax**
@@ -139,7 +135,7 @@ makeDateTime64(year, month, day, hour, minute, second[, fraction[, precision[, t
## timestamp
-Converts the first argument 'expr' to type [DateTime64(6)](../../sql-reference/data-types/datetime64.md).
+Converts the first argument 'expr' to type [DateTime64(6)](../data-types/datetime64.md).
If a second argument 'expr_time' is provided, it adds the specified time to the converted value.
**Syntax**
@@ -152,8 +148,8 @@ Alias: `TIMESTAMP`
**Arguments**
-- `expr` - Date or date with time. Type: [String](../../sql-reference/data-types/string.md).
-- `expr_time` - Optional parameter. Time to add. [String](../../sql-reference/data-types/string.md).
+- `expr` - Date or date with time. [String](../data-types/string.md).
+- `expr_time` - Optional parameter. Time to add. [String](../data-types/string.md).
**Examples**
@@ -183,7 +179,7 @@ Result:
**Returned value**
-- [DateTime64](../../sql-reference/data-types/datetime64.md)(6)
+- [DateTime64](../data-types/datetime64.md)(6)
## timeZone
@@ -200,9 +196,7 @@ Alias: `timezone`.
**Returned value**
-- Timezone.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Timezone. [String](../data-types/string.md).
**Example**
@@ -237,9 +231,7 @@ Alias: `serverTimezone`.
**Returned value**
-- Timezone.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Timezone. [String](../data-types/string.md).
**Example**
@@ -273,14 +265,12 @@ Alias: `toTimezone`.
**Arguments**
-- `value` — Time or date and time. [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `timezone` — Timezone for the returned value. [String](../../sql-reference/data-types/string.md). This argument is a constant, because `toTimezone` changes the timezone of a column (timezone is an attribute of `DateTime*` types).
+- `value` — Time or date and time. [DateTime64](../data-types/datetime64.md).
+- `timezone` — Timezone for the returned value. [String](../data-types/string.md). This argument is a constant, because `toTimezone` changes the timezone of a column (timezone is an attribute of `DateTime*` types).
**Returned value**
-- Date and time.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- Date and time. [DateTime](../data-types/datetime.md).
**Example**
@@ -320,7 +310,7 @@ int32samoa: 1546300800
## timeZoneOf
-Returns the timezone name of [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md) data types.
+Returns the timezone name of [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md) data types.
**Syntax**
@@ -332,13 +322,11 @@ Alias: `timezoneOf`.
**Arguments**
-- `value` — Date and time. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `value` — Date and time. [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-- Timezone name.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Timezone name. [String](../data-types/string.md).
**Example**
@@ -369,13 +357,11 @@ Alias: `timezoneOffset`.
**Arguments**
-- `value` — Date and time. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `value` — Date and time. [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-- Offset from UTC in seconds.
-
-Type: [Int32](../../sql-reference/data-types/int-uint.md).
+- Offset from UTC in seconds. [Int32](../data-types/int-uint.md).
**Example**
@@ -410,9 +396,7 @@ Alias: `YEAR`
**Returned value**
-- The year of the given date/time
-
-Type: `UInt16`
+- The year of the given date/time. [UInt16](../data-types/int-uint.md).
**Example**
@@ -446,9 +430,7 @@ Alias: `QUARTER`
**Returned value**
-- The quarter of the year (1, 2, 3 or 4) of the given date/time
-
-Type: `UInt8`
+- The quarter of the year (1, 2, 3 or 4) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -482,9 +464,7 @@ Alias: `MONTH`
**Returned value**
-- The month of the year (1 - 12) of the given date/time
-
-Type: `UInt8`
+- The month of the year (1 - 12) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -518,9 +498,7 @@ Alias: `DAYOFYEAR`
**Returned value**
-- The day of the year (1 - 366) of the given date/time
-
-Type: `UInt16`
+- The day of the year (1 - 366) of the given date/time. [UInt16](../data-types/int-uint.md).
**Example**
@@ -554,9 +532,7 @@ Aliases: `DAYOFMONTH`, `DAY`
**Returned value**
-- The day of the month (1 - 31) of the given date/time
-
-Type: `UInt8`
+- The day of the month (1 - 31) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -643,9 +619,7 @@ Alias: `HOUR`
**Returned value**
-- The hour of the day (0 - 23) of the given date/time
-
-Type: `UInt8`
+- The hour of the day (0 - 23) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -679,9 +653,7 @@ Alias: `MINUTE`
**Returned value**
-- The minute of the hour (0 - 59) of the given date/time
-
-Type: `UInt8`
+- The minute of the hour (0 - 59) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -715,9 +687,7 @@ Alias: `SECOND`
**Returned value**
-- The second in the minute (0 - 59) of the given date/time
-
-Type: `UInt8`
+- The second in the minute (0 - 59) of the given date/time. [UInt8](../data-types/int-uint.md).
**Example**
@@ -763,9 +733,7 @@ Result:
**Returned value**
-- The millisecond in the minute (0 - 59) of the given date/time
-
-Type: `UInt16`
+- The millisecond in the minute (0 - 59) of the given date/time. [UInt16](../data-types/int-uint.md).
## toUnixTimestamp
@@ -782,9 +750,7 @@ toUnixTimestamp(str, [timezone])
**Returned value**
-- Returns the unix timestamp.
-
-Type: `UInt32`.
+- Returns the unix timestamp. [UInt32](../data-types/int-uint.md).
**Example**
@@ -842,9 +808,7 @@ toStartOfYear(value)
**Returned value**
-- The first day of the year of the input date/time
-
-Type: `Date`
+- The first day of the year of the input date/time. [Date](../data-types/date.md).
**Example**
@@ -876,9 +840,7 @@ toStartOfISOYear(value)
**Returned value**
-- The first day of the year of the input date/time
-
-Type: `Date`
+- The first day of the year of the input date/time. [Date](../data-types/date.md).
**Example**
@@ -911,9 +873,7 @@ toStartOfQuarter(value)
**Returned value**
-- The first day of the quarter of the given date/time
-
-Type: `Date`
+- The first day of the quarter of the given date/time. [Date](../data-types/date.md).
**Example**
@@ -945,9 +905,7 @@ toStartOfMonth(value)
**Returned value**
-- The first day of the month of the given date/time
-
-Type: `Date`
+- The first day of the month of the given date/time. [Date](../data-types/date.md).
**Example**
@@ -985,9 +943,7 @@ Alias: `LAST_DAY`
**Returned value**
-- The last day of the month of the given date/time
-
-Type: `Date`
+- The last day of the month of the given date/time=. [Date](../data-types/date.md).
**Example**
@@ -1019,9 +975,7 @@ toMonday(value)
**Returned value**
-- The date of the nearest Monday on or prior to the given date
-
-Type: `Date`
+- The date of the nearest Monday on or prior to the given date. [Date](../data-types/date.md).
**Example**
@@ -1057,9 +1011,7 @@ toStartOfWeek(t[, mode[, timezone]])
**Returned value**
-- The date of the nearest Sunday or Monday on or prior to the given date, depending on the mode
-
-Type: `Date`
+- The date of the nearest Sunday or Monday on or prior to the given date, depending on the mode. [Date](../data-types/date.md).
**Example**
@@ -1102,9 +1054,7 @@ toLastDayOfWeek(t[, mode[, timezone]])
**Returned value**
-- The date of the nearest Sunday or Monday on or after the given date, depending on the mode
-
-Type: `Date`
+- The date of the nearest Sunday or Monday on or after the given date, depending on the mode. [Date](../data-types/date.md).
**Example**
@@ -1144,9 +1094,7 @@ toStartOfDay(value)
**Returned value**
-- The start of the day of the given date/time
-
-Type: `DateTime`
+- The start of the day of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1178,9 +1126,7 @@ toStartOfHour(value)
**Returned value**
-- The start of the hour of the given date/time
-
-Type: `DateTime`
+- The start of the hour of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1214,9 +1160,7 @@ toStartOfMinute(value)
**Returned value**
-- The start of the minute of the given date/time
-
-Type: `DateTime`
+- The start of the minute of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1248,14 +1192,12 @@ toStartOfSecond(value, [timezone])
**Arguments**
-- `value` — Date and time. [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `timezone` — [Timezone](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). If not specified, the function uses the timezone of the `value` parameter. [String](../../sql-reference/data-types/string.md).
+- `value` — Date and time. [DateTime64](../data-types/datetime64.md).
+- `timezone` — [Timezone](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). If not specified, the function uses the timezone of the `value` parameter. [String](../data-types/string.md).
**Returned value**
-- Input value without sub-seconds.
-
-Type: [DateTime64](../../sql-reference/data-types/datetime64.md).
+- Input value without sub-seconds. [DateTime64](../data-types/datetime64.md).
**Examples**
@@ -1309,9 +1251,7 @@ toStartOfFiveMinutes(value)
**Returned value**
-- The start of the five-minute interval of the given date/time
-
-Type: `DateTime`
+- The start of the five-minute interval of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1349,9 +1289,7 @@ toStartOfTenMinutes(value)
**Returned value**
-- The start of the ten-minute interval of the given date/time
-
-Type: `DateTime`
+- The start of the ten-minute interval of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1389,9 +1327,7 @@ toStartOfFifteenMinutes(value)
**Returned value**
-- The start of the fifteen-minute interval of the given date/time
-
-Type: `DateTime`
+- The start of the fifteen-minute interval of the given date/time. [DateTime](../data-types/datetime.md).
**Example**
@@ -1499,7 +1435,7 @@ This function returns the week number for date or datetime. The two-argument for
The following table describes how the mode argument works.
-| Mode | First day of week | Range | Week 1 is the first week … |
+| Mode | First day of week | Range | Week 1 is the first week ... |
|------|-------------------|-------|-------------------------------|
| 0 | Sunday | 0-53 | with a Sunday in this year |
| 1 | Monday | 0-53 | with 4 or more days this year |
@@ -1598,14 +1534,12 @@ Alias: `TO_DAYS`
**Arguments**
-- `date` — The date to calculate the number of days passed since year zero from. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `time_zone` — A String type const value or an expression represent the time zone. [String types](../../sql-reference/data-types/string.md)
+- `date` — The date to calculate the number of days passed since year zero from. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
+- `time_zone` — A String type const value or an expression represent the time zone. [String types](../data-types/string.md)
**Returned value**
-The number of days passed since date 0000-01-01.
-
-Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+The number of days passed since date 0000-01-01. [UInt32](../data-types/int-uint.md).
**Example**
@@ -1629,7 +1563,7 @@ Result:
Returns for a given number of days passed since [1 January 0000](https://en.wikipedia.org/wiki/Year_zero) the corresponding date in the [proleptic Gregorian calendar defined by ISO 8601](https://en.wikipedia.org/wiki/Gregorian_calendar#Proleptic_Gregorian_calendar). The calculation is the same as in MySQL's [`FROM_DAYS()`](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_from-days) function.
-The result is undefined if it cannot be represented within the bounds of the [Date](../../sql-reference/data-types/date.md) type.
+The result is undefined if it cannot be represented within the bounds of the [Date](../data-types/date.md) type.
**Syntax**
@@ -1645,9 +1579,7 @@ Alias: `FROM_DAYS`
**Returned value**
-The date corresponding to the number of days passed since year zero.
-
-Type: [Date](../../sql-reference/data-types/date.md).
+The date corresponding to the number of days passed since year zero. [Date](../data-types/date.md).
**Example**
@@ -1669,7 +1601,7 @@ Result:
## fromDaysSinceYearZero32
-Like [fromDaysSinceYearZero](#fromDaysSinceYearZero) but returns a [Date32](../../sql-reference/data-types/date32.md).
+Like [fromDaysSinceYearZero](#fromDaysSinceYearZero) but returns a [Date32](../data-types/date32.md).
## age
@@ -1686,7 +1618,7 @@ age('unit', startdate, enddate, [timezone])
**Arguments**
-- `unit` — The type of interval for result. [String](../../sql-reference/data-types/string.md).
+- `unit` — The type of interval for result. [String](../data-types/string.md).
Possible values:
- `nanosecond`, `nanoseconds`, `ns`
@@ -1701,17 +1633,15 @@ age('unit', startdate, enddate, [timezone])
- `quarter`, `quarters`, `qq`, `q`
- `year`, `years`, `yyyy`, `yy`
-- `startdate` — The first time value to subtract (the subtrahend). [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `startdate` — The first time value to subtract (the subtrahend). [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
-- `enddate` — The second time value to subtract from (the minuend). [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `enddate` — The second time value to subtract from (the minuend). [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional). If specified, it is applied to both `startdate` and `enddate`. If not specified, timezones of `startdate` and `enddate` are used. If they are not the same, the result is unspecified. [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional). If specified, it is applied to both `startdate` and `enddate`. If not specified, timezones of `startdate` and `enddate` are used. If they are not the same, the result is unspecified. [String](../data-types/string.md).
**Returned value**
-Difference between `enddate` and `startdate` expressed in `unit`.
-
-Type: [Int](../../sql-reference/data-types/int-uint.md).
+Difference between `enddate` and `startdate` expressed in `unit`. [Int](../data-types/int-uint.md).
**Example**
@@ -1764,7 +1694,7 @@ Aliases: `dateDiff`, `DATE_DIFF`, `timestampDiff`, `timestamp_diff`, `TIMESTAMP_
**Arguments**
-- `unit` — The type of interval for result. [String](../../sql-reference/data-types/string.md).
+- `unit` — The type of interval for result. [String](../data-types/string.md).
Possible values:
- `nanosecond`, `nanoseconds`, `ns`
@@ -1779,17 +1709,15 @@ Aliases: `dateDiff`, `DATE_DIFF`, `timestampDiff`, `timestamp_diff`, `TIMESTAMP_
- `quarter`, `quarters`, `qq`, `q`
- `year`, `years`, `yyyy`, `yy`
-- `startdate` — The first time value to subtract (the subtrahend). [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `startdate` — The first time value to subtract (the subtrahend). [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
-- `enddate` — The second time value to subtract from (the minuend). [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `enddate` — The second time value to subtract from (the minuend). [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional). If specified, it is applied to both `startdate` and `enddate`. If not specified, timezones of `startdate` and `enddate` are used. If they are not the same, the result is unspecified. [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional). If specified, it is applied to both `startdate` and `enddate`. If not specified, timezones of `startdate` and `enddate` are used. If they are not the same, the result is unspecified. [String](../data-types/string.md).
**Returned value**
-Difference between `enddate` and `startdate` expressed in `unit`.
-
-Type: [Int](../../sql-reference/data-types/int-uint.md).
+Difference between `enddate` and `startdate` expressed in `unit`. [Int](../data-types/int-uint.md).
**Example**
@@ -1853,14 +1781,12 @@ Alias: `dateTrunc`.
`unit` argument is case-insensitive.
-- `value` — Date and time. [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). If not specified, the function uses the timezone of the `value` parameter. [String](../../sql-reference/data-types/string.md).
+- `value` — Date and time. [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). If not specified, the function uses the timezone of the `value` parameter. [String](../data-types/string.md).
**Returned value**
-- Value, truncated to the specified part of date.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- Value, truncated to the specified part of date. [DateTime](../data-types/datetime.md).
**Example**
@@ -1918,7 +1844,7 @@ Aliases: `dateAdd`, `DATE_ADD`.
**Arguments**
-- `unit` — The type of interval to add. Note: This is not a [String](../../sql-reference/data-types/string.md) and must therefore not be quoted.
+- `unit` — The type of interval to add. Note: This is not a [String](../data-types/string.md) and must therefore not be quoted.
Possible values:
- `second`
@@ -1930,14 +1856,12 @@ Aliases: `dateAdd`, `DATE_ADD`.
- `quarter`
- `year`
-- `value` — Value of interval to add. [Int](../../sql-reference/data-types/int-uint.md).
-- `date` — The date or date with time to which `value` is added. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `value` — Value of interval to add. [Int](../data-types/int-uint.md).
+- `date` — The date or date with time to which `value` is added. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-Date or date with time obtained by adding `value`, expressed in `unit`, to `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time obtained by adding `value`, expressed in `unit`, to `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -1994,7 +1918,7 @@ Aliases: `dateSub`, `DATE_SUB`.
**Arguments**
-- `unit` — The type of interval to subtract. Note: This is not a [String](../../sql-reference/data-types/string.md) and must therefore not be quoted.
+- `unit` — The type of interval to subtract. Note: This is not a [String](../data-types/string.md) and must therefore not be quoted.
Possible values:
@@ -2007,14 +1931,12 @@ Aliases: `dateSub`, `DATE_SUB`.
- `quarter`
- `year`
-- `value` — Value of interval to subtract. [Int](../../sql-reference/data-types/int-uint.md).
-- `date` — The date or date with time from which `value` is subtracted. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `value` — Value of interval to subtract. [Int](../data-types/int-uint.md).
+- `date` — The date or date with time from which `value` is subtracted. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-Date or date with time obtained by subtracting `value`, expressed in `unit`, from `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time obtained by subtracting `value`, expressed in `unit`, from `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2063,9 +1985,9 @@ Aliases: `timeStampAdd`, `TIMESTAMP_ADD`.
**Arguments**
-- `date` — Date or date with time. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `value` — Value of interval to add. [Int](../../sql-reference/data-types/int-uint.md).
-- `unit` — The type of interval to add. [String](../../sql-reference/data-types/string.md).
+- `date` — Date or date with time. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
+- `value` — Value of interval to add. [Int](../data-types/int-uint.md).
+- `unit` — The type of interval to add. [String](../data-types/string.md).
Possible values:
- `second`
@@ -2079,9 +2001,7 @@ Aliases: `timeStampAdd`, `TIMESTAMP_ADD`.
**Returned value**
-Date or date with time with the specified `value` expressed in `unit` added to `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time with the specified `value` expressed in `unit` added to `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2113,7 +2033,7 @@ Aliases: `timeStampSub`, `TIMESTAMP_SUB`.
**Arguments**
-- `unit` — The type of interval to subtract. [String](../../sql-reference/data-types/string.md).
+- `unit` — The type of interval to subtract. [String](../data-types/string.md).
Possible values:
- `second`
@@ -2125,14 +2045,12 @@ Aliases: `timeStampSub`, `TIMESTAMP_SUB`.
- `quarter`
- `year`
-- `value` — Value of interval to subtract. [Int](../../sql-reference/data-types/int-uint.md).
-- `date` — Date or date with time. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `value` — Value of interval to subtract. [Int](../data-types/int-uint.md).
+- `date` — Date or date with time. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-Date or date with time obtained by subtracting `value`, expressed in `unit`, from `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time obtained by subtracting `value`, expressed in `unit`, from `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2162,14 +2080,12 @@ addDate(date, interval)
**Arguments**
-- `date` — The date or date with time to which `interval` is added. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md), [DateTime64](../../sql-reference/data-types/datetime64.md), or [String](../../sql-reference/data-types/string.md)
-- `interval` — Interval to add. [Interval](../../sql-reference/data-types/special-data-types/interval.md).
+- `date` — The date or date with time to which `interval` is added. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md), [DateTime64](../data-types/datetime64.md), or [String](../data-types/string.md)
+- `interval` — Interval to add. [Interval](../data-types/special-data-types/interval.md).
**Returned value**
-Date or date with time obtained by adding `interval` to `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time obtained by adding `interval` to `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2205,14 +2121,12 @@ subDate(date, interval)
**Arguments**
-- `date` — The date or date with time from which `interval` is subtracted. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md), [DateTime64](../../sql-reference/data-types/datetime64.md), or [String](../../sql-reference/data-types/string.md)
-- `interval` — Interval to subtract. [Interval](../../sql-reference/data-types/special-data-types/interval.md).
+- `date` — The date or date with time from which `interval` is subtracted. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md), [DateTime64](../data-types/datetime64.md), or [String](../data-types/string.md)
+- `interval` — Interval to subtract. [Interval](../data-types/special-data-types/interval.md).
**Returned value**
-Date or date with time obtained by subtracting `interval` from `date`.
-
-Type: [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+Date or date with time obtained by subtracting `interval` from `date`. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2248,13 +2162,11 @@ now([timezone])
**Arguments**
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../data-types/string.md).
**Returned value**
-- Current date and time.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- Current date and time. [DateTime](../data-types/datetime.md).
**Example**
@@ -2299,13 +2211,11 @@ now64([scale], [timezone])
**Arguments**
- `scale` - Tick size (precision): 10-precision seconds. Valid range: [ 0 : 9 ]. Typically, are used - 3 (default) (milliseconds), 6 (microseconds), 9 (nanoseconds).
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../data-types/string.md).
**Returned value**
-- Current date and time with sub-second precision.
-
-Type: [DateTime64](../../sql-reference/data-types/datetime64.md).
+- Current date and time with sub-second precision. [DateTime64](../data-types/datetime64.md).
**Example**
@@ -2335,13 +2245,11 @@ nowInBlock([timezone])
**Arguments**
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../data-types/string.md).
**Returned value**
-- Current date and time at the moment of processing of each block of data.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- Current date and time at the moment of processing of each block of data. [DateTime](../data-types/datetime.md).
**Example**
@@ -2381,9 +2289,7 @@ today()
**Returned value**
-- Current date
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- Current date. [DateTime](../data-types/datetime.md).
**Example**
@@ -2473,7 +2379,7 @@ Result:
## YYYYMMDDToDate
-Converts a number containing the year, month and day number to a [Date](../../sql-reference/data-types/date.md).
+Converts a number containing the year, month and day number to a [Date](../data-types/date.md).
This function is the opposite of function `toYYYYMMDD()`.
@@ -2487,13 +2393,11 @@ YYYYMMDDToDate(yyyymmdd);
**Arguments**
-- `yyyymmdd` - A number representing the year, month and day. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `yyyymmdd` - A number representing the year, month and day. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
**Returned value**
-- a date created from the arguments.
-
-Type: [Date](../../sql-reference/data-types/date.md).
+- a date created from the arguments. [Date](../data-types/date.md).
**Example**
@@ -2511,11 +2415,11 @@ Result:
## YYYYMMDDToDate32
-Like function `YYYYMMDDToDate()` but produces a [Date32](../../sql-reference/data-types/date32.md).
+Like function `YYYYMMDDToDate()` but produces a [Date32](../data-types/date32.md).
## YYYYMMDDhhmmssToDateTime
-Converts a number containing the year, month, day, hours, minute and second number to a [DateTime](../../sql-reference/data-types/datetime.md).
+Converts a number containing the year, month, day, hours, minute and second number to a [DateTime](../data-types/datetime.md).
The output is undefined if the input does not encode a valid DateTime value.
@@ -2529,14 +2433,12 @@ YYYYMMDDhhmmssToDateTime(yyyymmddhhmmss[, timezone]);
**Arguments**
-- `yyyymmddhhmmss` - A number representing the year, month and day. [Integer](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `yyyymmddhhmmss` - A number representing the year, month and day. [Integer](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
- `timezone` - [Timezone](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional).
**Returned value**
-- a date with time created from the arguments.
-
-Type: [DateTime](../../sql-reference/data-types/datetime.md).
+- a date with time created from the arguments. [DateTime](../data-types/datetime.md).
**Example**
@@ -2554,7 +2456,7 @@ Result:
## YYYYMMDDhhmmssToDateTime64
-Like function `YYYYMMDDhhmmssToDate()` but produces a [DateTime64](../../sql-reference/data-types/datetime64.md).
+Like function `YYYYMMDDhhmmssToDate()` but produces a [DateTime64](../data-types/datetime64.md).
Accepts an additional, optional `precision` parameter after the `timezone` parameter.
@@ -3551,7 +3453,7 @@ Formats a Time according to the given Format string. Format is a constant expres
formatDateTime uses MySQL datetime format style, refer to https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format.
-The opposite operation of this function is [parseDateTime](/docs/en/sql-reference/functions/type-conversion-functions.md#type_conversion_functions-parseDateTime).
+The opposite operation of this function is [parseDateTime](../functions/type-conversion-functions.md#type_conversion_functions-parseDateTime).
Alias: `DATE_FORMAT`.
@@ -3677,7 +3579,7 @@ LIMIT 10
Similar to formatDateTime, except that it formats datetime in Joda style instead of MySQL style. Refer to https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html.
-The opposite operation of this function is [parseDateTimeInJodaSyntax](/docs/en/sql-reference/functions/type-conversion-functions.md#type_conversion_functions-parseDateTimeInJodaSyntax).
+The opposite operation of this function is [parseDateTimeInJodaSyntax](../functions/type-conversion-functions.md#type_conversion_functions-parseDateTimeInJodaSyntax).
**Replacement fields**
@@ -3737,15 +3639,13 @@ dateName(date_part, date)
**Arguments**
-- `date_part` — Date part. Possible values: 'year', 'quarter', 'month', 'week', 'dayofyear', 'day', 'weekday', 'hour', 'minute', 'second'. [String](../../sql-reference/data-types/string.md).
-- `date` — Date. [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `timezone` — Timezone. Optional. [String](../../sql-reference/data-types/string.md).
+- `date_part` — Date part. Possible values: 'year', 'quarter', 'month', 'week', 'dayofyear', 'day', 'weekday', 'hour', 'minute', 'second'. [String](../data-types/string.md).
+- `date` — Date. [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
+- `timezone` — Timezone. Optional. [String](../data-types/string.md).
**Returned value**
-- The specified part of date.
-
-Type: [String](../../sql-reference/data-types/string.md#string)
+- The specified part of date. [String](../data-types/string.md#string)
**Example**
@@ -3777,13 +3677,11 @@ monthName(date)
**Arguments**
-- `date` — Date or date with time. [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `date` — Date or date with time. [Date](../data-types/date.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md).
**Returned value**
-- The name of the month.
-
-Type: [String](../../sql-reference/data-types/string.md#string)
+- The name of the month. [String](../data-types/string.md#string)
**Example**
@@ -3806,7 +3704,7 @@ This function converts a Unix timestamp to a calendar date and a time of a day.
It can be called in two ways:
-When given a single argument of type [Integer](../../sql-reference/data-types/int-uint.md), it returns a value of type [DateTime](../../sql-reference/data-types/datetime.md), i.e. behaves like [toDateTime](../../sql-reference/functions/type-conversion-functions.md#todatetime).
+When given a single argument of type [Integer](../data-types/int-uint.md), it returns a value of type [DateTime](../data-types/datetime.md), i.e. behaves like [toDateTime](../../sql-reference/functions/type-conversion-functions.md#todatetime).
Alias: `FROM_UNIXTIME`.
@@ -3824,7 +3722,7 @@ Result:
└──────────────────────────────┘
```
-When given two or three arguments where the first argument is a value of type [Integer](../../sql-reference/data-types/int-uint.md), [Date](../../sql-reference/data-types/date.md), [Date32](../../sql-reference/data-types/date32.md), [DateTime](../../sql-reference/data-types/datetime.md) or [DateTime64](../../sql-reference/data-types/datetime64.md), the second argument is a constant format string and the third argument is an optional constant time zone string, the function returns a value of type [String](../../sql-reference/data-types/string.md#string), i.e. it behaves like [formatDateTime](#formatdatetime). In this case, [MySQL's datetime format style](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format) is used.
+When given two or three arguments where the first argument is a value of type [Integer](../data-types/int-uint.md), [Date](../data-types/date.md), [Date32](../data-types/date32.md), [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md), the second argument is a constant format string and the third argument is an optional constant time zone string, the function returns a value of type [String](../data-types/string.md#string), i.e. it behaves like [formatDateTime](#formatdatetime). In this case, [MySQL's datetime format style](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format) is used.
**Example:**
@@ -3874,13 +3772,11 @@ toModifiedJulianDay(date)
**Arguments**
-- `date` — Date in text form. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `date` — Date in text form. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
**Returned value**
-- Modified Julian Day number.
-
-Type: [Int32](../../sql-reference/data-types/int-uint.md).
+- Modified Julian Day number. [Int32](../data-types/int-uint.md).
**Example**
@@ -3908,13 +3804,11 @@ toModifiedJulianDayOrNull(date)
**Arguments**
-- `date` — Date in text form. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `date` — Date in text form. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
**Returned value**
-- Modified Julian Day number.
-
-Type: [Nullable(Int32)](../../sql-reference/data-types/int-uint.md).
+- Modified Julian Day number. [Nullable(Int32)](../data-types/int-uint.md).
**Example**
@@ -3942,13 +3836,11 @@ fromModifiedJulianDay(day)
**Arguments**
-- `day` — Modified Julian Day number. [Any integral types](../../sql-reference/data-types/int-uint.md).
+- `day` — Modified Julian Day number. [Any integral types](../data-types/int-uint.md).
**Returned value**
-- Date in text form.
-
-Type: [String](../../sql-reference/data-types/string.md)
+- Date in text form. [String](../data-types/string.md)
**Example**
@@ -3976,13 +3868,11 @@ fromModifiedJulianDayOrNull(day)
**Arguments**
-- `day` — Modified Julian Day number. [Any integral types](../../sql-reference/data-types/int-uint.md).
+- `day` — Modified Julian Day number. [Any integral types](../data-types/int-uint.md).
**Returned value**
-- Date in text form.
-
-Type: [Nullable(String)](../../sql-reference/data-types/string.md)
+- Date in text form. [Nullable(String)](../data-types/string.md)
**Example**
@@ -4010,8 +3900,8 @@ toUTCTimestamp(time_val, time_zone)
**Arguments**
-- `time_val` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../../sql-reference/data-types/datetime.md)
-- `time_zone` — A String type const value or an expression represent the time zone. [String types](../../sql-reference/data-types/string.md)
+- `time_val` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../data-types/datetime.md)
+- `time_zone` — A String type const value or an expression represent the time zone. [String types](../data-types/string.md)
**Returned value**
@@ -4043,8 +3933,8 @@ fromUTCTimestamp(time_val, time_zone)
**Arguments**
-- `time_val` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../../sql-reference/data-types/datetime.md)
-- `time_zone` — A String type const value or an expression represent the time zone. [String types](../../sql-reference/data-types/string.md)
+- `time_val` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../data-types/datetime.md)
+- `time_zone` — A String type const value or an expression represent the time zone. [String types](../data-types/string.md)
**Returned value**
@@ -4075,8 +3965,8 @@ timeDiff(first_datetime, second_datetime)
*Arguments**
-- `first_datetime` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../../sql-reference/data-types/datetime.md)
-- `second_datetime` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../../sql-reference/data-types/datetime.md)
+- `first_datetime` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../data-types/datetime.md)
+- `second_datetime` — A DateTime/DateTime64 type const value or an expression . [DateTime/DateTime64 types](../data-types/datetime.md)
**Returned value**
diff --git a/docs/en/sql-reference/functions/distance-functions.md b/docs/en/sql-reference/functions/distance-functions.md
index 5f3514049c7..a455d0af91b 100644
--- a/docs/en/sql-reference/functions/distance-functions.md
+++ b/docs/en/sql-reference/functions/distance-functions.md
@@ -20,13 +20,11 @@ Alias: `normL1`.
**Arguments**
-- `vector` — [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector` — [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- L1-norm or [taxicab geometry](https://en.wikipedia.org/wiki/Taxicab_geometry) distance.
-
-Type: [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- L1-norm or [taxicab geometry](https://en.wikipedia.org/wiki/Taxicab_geometry) distance. [UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
**Examples**
@@ -58,13 +56,11 @@ Alias: `normL2`.
**Arguments**
-- `vector` — [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector` — [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- L2-norm or [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance).
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- L2-norm or [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance). [Float](../data-types/float.md).
**Example**
@@ -95,13 +91,11 @@ Alias: `normL2Squared`.
***Arguments**
-- `vector` — [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector` — [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- L2-norm squared.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- L2-norm squared. [Float](../data-types/float.md).
**Example**
@@ -133,13 +127,11 @@ Alias: `normLinf`.
**Arguments**
-- `vector` — [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector` — [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- Linf-norm or the maximum absolute value.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- Linf-norm or the maximum absolute value. [Float](../data-types/float.md).
**Example**
@@ -171,14 +163,12 @@ Alias: `normLp`.
**Arguments**
-- `vector` — [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `p` — The power. Possible values: real number in `[1; inf)`. [UInt](../../sql-reference/data-types/int-uint.md) or [Float](../../sql-reference/data-types/float.md).
+- `vector` — [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `p` — The power. Possible values: real number in `[1; inf)`. [UInt](../data-types/int-uint.md) or [Float](../data-types/float.md).
**Returned value**
-- [Lp-norm](https://en.wikipedia.org/wiki/Norm_(mathematics)#p-norm)
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- [Lp-norm](https://en.wikipedia.org/wiki/Norm_(mathematics)#p-norm). [Float](../data-types/float.md).
**Example**
@@ -210,14 +200,12 @@ Alias: `distanceL1`.
**Arguments**
-- `vector1` — First vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector2` — Second vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector1` — First vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector2` — Second vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- 1-norm distance.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- 1-norm distance. [Float](../data-types/float.md).
**Example**
@@ -249,14 +237,12 @@ Alias: `distanceL2`.
**Arguments**
-- `vector1` — First vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector2` — Second vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector1` — First vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector2` — Second vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- 2-norm distance.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- 2-norm distance. [Float](../data-types/float.md).
**Example**
@@ -288,12 +274,12 @@ Alias: `distanceL2Squared`.
**Arguments**
-- `vector1` — First vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector2` — Second vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector1` — First vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector2` — Second vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-Type: [Float](../../sql-reference/data-types/float.md).
+- Sum of the squares of the difference between the corresponding elements of two vectors. [Float](../data-types/float.md).
**Example**
@@ -325,14 +311,12 @@ Alias: `distanceLinf`.
**Arguments**
-- `vector1` — First vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector1` — Second vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector1` — First vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector1` — Second vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- Infinity-norm distance.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- Infinity-norm distance. [Float](../data-types/float.md).
**Example**
@@ -364,15 +348,13 @@ Alias: `distanceLp`.
**Arguments**
-- `vector1` — First vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector2` — Second vector. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `p` — The power. Possible values: real number from `[1; inf)`. [UInt](../../sql-reference/data-types/int-uint.md) or [Float](../../sql-reference/data-types/float.md).
+- `vector1` — First vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector2` — Second vector. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `p` — The power. Possible values: real number from `[1; inf)`. [UInt](../data-types/int-uint.md) or [Float](../data-types/float.md).
**Returned value**
-- p-norm distance.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- p-norm distance. [Float](../data-types/float.md).
**Example**
@@ -405,13 +387,11 @@ Alias: `normalizeL1`.
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
**Returned value**
-- Unit vector.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md) of [Float](../../sql-reference/data-types/float.md).
+- Unit vector. [Tuple](../data-types/tuple.md) of [Float](../data-types/float.md).
**Example**
@@ -443,13 +423,11 @@ Alias: `normalizeL1`.
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
**Returned value**
-- Unit vector.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md) of [Float](../../sql-reference/data-types/float.md).
+- Unit vector. [Tuple](../data-types/tuple.md) of [Float](../data-types/float.md).
**Example**
@@ -481,13 +459,11 @@ Alias: `normalizeLinf `.
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
**Returned value**
-- Unit vector.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md) of [Float](../../sql-reference/data-types/float.md).
+- Unit vector. [Tuple](../data-types/tuple.md) of [Float](../data-types/float.md).
**Example**
@@ -519,14 +495,12 @@ Alias: `normalizeLp `.
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
-- `p` — The power. Possible values: any number from [1;inf). [UInt](../../sql-reference/data-types/int-uint.md) or [Float](../../sql-reference/data-types/float.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
+- `p` — The power. Possible values: any number from [1;inf). [UInt](../data-types/int-uint.md) or [Float](../data-types/float.md).
**Returned value**
-- Unit vector.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md) of [Float](../../sql-reference/data-types/float.md).
+- Unit vector. [Tuple](../data-types/tuple.md) of [Float](../data-types/float.md).
**Example**
@@ -556,14 +530,12 @@ cosineDistance(vector1, vector2)
**Arguments**
-- `vector1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
-- `vector2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md) or [Array](../../sql-reference/data-types/array.md).
+- `vector1` — First tuple. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
+- `vector2` — Second tuple. [Tuple](../data-types/tuple.md) or [Array](../data-types/array.md).
**Returned value**
-- Cosine of the angle between two vectors subtracted from one.
-
-Type: [Float](../../sql-reference/data-types/float.md).
+- Cosine of the angle between two vectors subtracted from one. [Float](../data-types/float.md).
**Examples**
diff --git a/docs/en/sql-reference/functions/encoding-functions.md b/docs/en/sql-reference/functions/encoding-functions.md
index 4f6da764b3c..408b605727d 100644
--- a/docs/en/sql-reference/functions/encoding-functions.md
+++ b/docs/en/sql-reference/functions/encoding-functions.md
@@ -18,13 +18,11 @@ char(number_1, [number_2, ..., number_n]);
**Arguments**
-- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md).
+- `number_1, number_2, ..., number_n` — Numerical arguments interpreted as integers. Types: [Int](../data-types/int-uint.md), [Float](../data-types/float.md).
**Returned value**
-- a string of given bytes.
-
-Type: `String`.
+- a string of given bytes. [String](../data-types/string.md).
**Example**
@@ -88,23 +86,21 @@ The function is using uppercase letters `A-F` and not using any prefixes (like `
For integer arguments, it prints hex digits (“nibbles”) from the most significant to least significant (big-endian or “human-readable” order). It starts with the most significant non-zero byte (leading zero bytes are omitted) but always prints both digits of every byte even if the leading digit is zero.
-Values of type [Date](../../sql-reference/data-types/date.md) and [DateTime](../../sql-reference/data-types/datetime.md) are formatted as corresponding integers (the number of days since Epoch for Date and the value of Unix Timestamp for DateTime).
+Values of type [Date](../data-types/date.md) and [DateTime](../data-types/datetime.md) are formatted as corresponding integers (the number of days since Epoch for Date and the value of Unix Timestamp for DateTime).
-For [String](../../sql-reference/data-types/string.md) and [FixedString](../../sql-reference/data-types/fixedstring.md), all bytes are simply encoded as two hexadecimal numbers. Zero bytes are not omitted.
+For [String](../data-types/string.md) and [FixedString](../data-types/fixedstring.md), all bytes are simply encoded as two hexadecimal numbers. Zero bytes are not omitted.
-Values of [Float](../../sql-reference/data-types/float.md) and [Decimal](../../sql-reference/data-types/decimal.md) types are encoded as their representation in memory. As we support little-endian architecture, they are encoded in little-endian. Zero leading/trailing bytes are not omitted.
+Values of [Float](../data-types/float.md) and [Decimal](../data-types/decimal.md) types are encoded as their representation in memory. As we support little-endian architecture, they are encoded in little-endian. Zero leading/trailing bytes are not omitted.
Values of [UUID](../data-types/uuid.md) type are encoded as big-endian order string.
**Arguments**
-- `arg` — A value to convert to hexadecimal. Types: [String](../../sql-reference/data-types/string.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md), [Decimal](../../sql-reference/data-types/decimal.md), [Date](../../sql-reference/data-types/date.md) or [DateTime](../../sql-reference/data-types/datetime.md).
+- `arg` — A value to convert to hexadecimal. Types: [String](../data-types/string.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md), [Decimal](../data-types/decimal.md), [Date](../data-types/date.md) or [DateTime](../data-types/datetime.md).
**Returned value**
-- A string with the hexadecimal representation of the argument.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A string with the hexadecimal representation of the argument. [String](../data-types/string.md).
**Examples**
@@ -185,15 +181,13 @@ unhex(arg)
**Arguments**
-- `arg` — A string containing any number of hexadecimal digits. Type: [String](../../sql-reference/data-types/string.md), [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `arg` — A string containing any number of hexadecimal digits. [String](../data-types/string.md), [FixedString](../data-types/fixedstring.md).
Supports both uppercase and lowercase letters `A-F`. The number of hexadecimal digits does not have to be even. If it is odd, the last digit is interpreted as the least significant half of the `00-0F` byte. If the argument string contains anything other than hexadecimal digits, some implementation-defined result is returned (an exception isn’t thrown). For a numeric argument the inverse of hex(N) is not performed by unhex().
**Returned value**
-- A binary string (BLOB).
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A binary string (BLOB). [String](../data-types/string.md).
**Example**
@@ -237,23 +231,21 @@ Alias: `BIN`.
For integer arguments, it prints bin digits from the most significant to least significant (big-endian or “human-readable” order). It starts with the most significant non-zero byte (leading zero bytes are omitted) but always prints eight digits of every byte if the leading digit is zero.
-Values of type [Date](../../sql-reference/data-types/date.md) and [DateTime](../../sql-reference/data-types/datetime.md) are formatted as corresponding integers (the number of days since Epoch for `Date` and the value of Unix Timestamp for `DateTime`).
+Values of type [Date](../data-types/date.md) and [DateTime](../data-types/datetime.md) are formatted as corresponding integers (the number of days since Epoch for `Date` and the value of Unix Timestamp for `DateTime`).
-For [String](../../sql-reference/data-types/string.md) and [FixedString](../../sql-reference/data-types/fixedstring.md), all bytes are simply encoded as eight binary numbers. Zero bytes are not omitted.
+For [String](../data-types/string.md) and [FixedString](../data-types/fixedstring.md), all bytes are simply encoded as eight binary numbers. Zero bytes are not omitted.
-Values of [Float](../../sql-reference/data-types/float.md) and [Decimal](../../sql-reference/data-types/decimal.md) types are encoded as their representation in memory. As we support little-endian architecture, they are encoded in little-endian. Zero leading/trailing bytes are not omitted.
+Values of [Float](../data-types/float.md) and [Decimal](../data-types/decimal.md) types are encoded as their representation in memory. As we support little-endian architecture, they are encoded in little-endian. Zero leading/trailing bytes are not omitted.
Values of [UUID](../data-types/uuid.md) type are encoded as big-endian order string.
**Arguments**
-- `arg` — A value to convert to binary. [String](../../sql-reference/data-types/string.md), [FixedString](../../sql-reference/data-types/fixedstring.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md), [Decimal](../../sql-reference/data-types/decimal.md), [Date](../../sql-reference/data-types/date.md), or [DateTime](../../sql-reference/data-types/datetime.md).
+- `arg` — A value to convert to binary. [String](../data-types/string.md), [FixedString](../data-types/fixedstring.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md), [Decimal](../data-types/decimal.md), [Date](../data-types/date.md), or [DateTime](../data-types/datetime.md).
**Returned value**
-- A string with the binary representation of the argument.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A string with the binary representation of the argument. [String](../data-types/string.md).
**Examples**
@@ -338,13 +330,11 @@ Supports binary digits `0` and `1`. The number of binary digits does not have to
**Arguments**
-- `arg` — A string containing any number of binary digits. [String](../../sql-reference/data-types/string.md).
+- `arg` — A string containing any number of binary digits. [String](../data-types/string.md).
**Returned value**
-- A binary string (BLOB).
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A binary string (BLOB). [String](../data-types/string.md).
**Examples**
@@ -396,13 +386,11 @@ bitPositionsToArray(arg)
**Arguments**
-- `arg` — Integer value. [Int/UInt](../../sql-reference/data-types/int-uint.md).
+- `arg` — Integer value. [Int/UInt](../data-types/int-uint.md).
**Returned value**
-- An array containing a list of positions of bits that equal `1`, in ascending order.
-
-Type: [Array](../../sql-reference/data-types/array.md)([UInt64](../../sql-reference/data-types/int-uint.md)).
+- An array containing a list of positions of bits that equal `1`, in ascending order. [Array](../data-types/array.md)([UInt64](../data-types/int-uint.md)).
**Example**
@@ -454,13 +442,11 @@ mortonEncode(args)
**Parameters**
-- `args`: up to 8 [unsigned integers](../../sql-reference/data-types/int-uint.md) or columns of the aforementioned type.
+- `args`: up to 8 [unsigned integers](../data-types/int-uint.md) or columns of the aforementioned type.
**Returned value**
-- A UInt64 code
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md)
+- A UInt64 code. [UInt64](../data-types/int-uint.md)
**Example**
@@ -477,7 +463,7 @@ Result:
### Expanded mode
-Accepts a range mask ([tuple](../../sql-reference/data-types/tuple.md)) as a first argument and up to 8 [unsigned integers](../../sql-reference/data-types/int-uint.md) as other arguments.
+Accepts a range mask ([tuple](../data-types/tuple.md)) as a first argument and up to 8 [unsigned integers](../data-types/int-uint.md) as other arguments.
Each number in the mask configures the amount of range expansion:
1 - no expansion
@@ -494,15 +480,13 @@ mortonEncode(range_mask, args)
**Parameters**
- `range_mask`: 1-8.
-- `args`: up to 8 [unsigned integers](../../sql-reference/data-types/int-uint.md) or columns of the aforementioned type.
+- `args`: up to 8 [unsigned integers](../data-types/int-uint.md) or columns of the aforementioned type.
Note: when using columns for `args` the provided `range_mask` tuple should still be a constant.
**Returned value**
-- A UInt64 code
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md)
+- A UInt64 code. [UInt64](../data-types/int-uint.md)
**Example**
@@ -595,7 +579,7 @@ Result:
**implementation details**
-Please note that you can fit only so many bits of information into Morton code as [UInt64](../../sql-reference/data-types/int-uint.md) has. Two arguments will have a range of maximum 2^32 (64/2) each, three arguments a range of max 2^21 (64/3) each and so on. All overflow will be clamped to zero.
+Please note that you can fit only so many bits of information into Morton code as [UInt64](../data-types/int-uint.md) has. Two arguments will have a range of maximum 2^32 (64/2) each, three arguments a range of max 2^21 (64/3) each and so on. All overflow will be clamped to zero.
## mortonDecode
@@ -617,13 +601,11 @@ mortonDecode(tuple_size, code)
**Parameters**
- `tuple_size`: integer value no more than 8.
-- `code`: [UInt64](../../sql-reference/data-types/int-uint.md) code.
+- `code`: [UInt64](../data-types/int-uint.md) code.
**Returned value**
-- [tuple](../../sql-reference/data-types/tuple.md) of the specified size.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md)
+- [tuple](../data-types/tuple.md) of the specified size. [UInt64](../data-types/int-uint.md)
**Example**
diff --git a/docs/en/sql-reference/functions/encryption-functions.md b/docs/en/sql-reference/functions/encryption-functions.md
index 00c9ef376d3..5d82e26eb32 100644
--- a/docs/en/sql-reference/functions/encryption-functions.md
+++ b/docs/en/sql-reference/functions/encryption-functions.md
@@ -30,15 +30,15 @@ encrypt('mode', 'plaintext', 'key' [, iv, aad])
**Arguments**
-- `mode` — Encryption mode. [String](../../sql-reference/data-types/string.md#string).
-- `plaintext` — Text that need to be encrypted. [String](../../sql-reference/data-types/string.md#string).
-- `key` — Encryption key. [String](../../sql-reference/data-types/string.md#string).
-- `iv` — Initialization vector. Required for `-gcm` modes, optional for others. [String](../../sql-reference/data-types/string.md#string).
-- `aad` — Additional authenticated data. It isn't encrypted, but it affects decryption. Works only in `-gcm` modes, for others would throw an exception. [String](../../sql-reference/data-types/string.md#string).
+- `mode` — Encryption mode. [String](../data-types/string.md#string).
+- `plaintext` — Text that need to be encrypted. [String](../data-types/string.md#string).
+- `key` — Encryption key. [String](../data-types/string.md#string).
+- `iv` — Initialization vector. Required for `-gcm` modes, optional for others. [String](../data-types/string.md#string).
+- `aad` — Additional authenticated data. It isn't encrypted, but it affects decryption. Works only in `-gcm` modes, for others would throw an exception. [String](../data-types/string.md#string).
**Returned value**
-- Ciphertext binary string. [String](../../sql-reference/data-types/string.md#string).
+- Ciphertext binary string. [String](../data-types/string.md#string).
**Examples**
@@ -123,14 +123,14 @@ aes_encrypt_mysql('mode', 'plaintext', 'key' [, iv])
**Arguments**
-- `mode` — Encryption mode. [String](../../sql-reference/data-types/string.md#string).
-- `plaintext` — Text that needs to be encrypted. [String](../../sql-reference/data-types/string.md#string).
-- `key` — Encryption key. If key is longer than required by mode, MySQL-specific key folding is performed. [String](../../sql-reference/data-types/string.md#string).
-- `iv` — Initialization vector. Optional, only first 16 bytes are taken into account [String](../../sql-reference/data-types/string.md#string).
+- `mode` — Encryption mode. [String](../data-types/string.md#string).
+- `plaintext` — Text that needs to be encrypted. [String](../data-types/string.md#string).
+- `key` — Encryption key. If key is longer than required by mode, MySQL-specific key folding is performed. [String](../data-types/string.md#string).
+- `iv` — Initialization vector. Optional, only first 16 bytes are taken into account [String](../data-types/string.md#string).
**Returned value**
-- Ciphertext binary string. [String](../../sql-reference/data-types/string.md#string).
+- Ciphertext binary string. [String](../data-types/string.md#string).
**Examples**
@@ -230,15 +230,15 @@ decrypt('mode', 'ciphertext', 'key' [, iv, aad])
**Arguments**
-- `mode` — Decryption mode. [String](../../sql-reference/data-types/string.md#string).
-- `ciphertext` — Encrypted text that needs to be decrypted. [String](../../sql-reference/data-types/string.md#string).
-- `key` — Decryption key. [String](../../sql-reference/data-types/string.md#string).
-- `iv` — Initialization vector. Required for `-gcm` modes, Optional for others. [String](../../sql-reference/data-types/string.md#string).
-- `aad` — Additional authenticated data. Won't decrypt if this value is incorrect. Works only in `-gcm` modes, for others would throw an exception. [String](../../sql-reference/data-types/string.md#string).
+- `mode` — Decryption mode. [String](../data-types/string.md#string).
+- `ciphertext` — Encrypted text that needs to be decrypted. [String](../data-types/string.md#string).
+- `key` — Decryption key. [String](../data-types/string.md#string).
+- `iv` — Initialization vector. Required for `-gcm` modes, Optional for others. [String](../data-types/string.md#string).
+- `aad` — Additional authenticated data. Won't decrypt if this value is incorrect. Works only in `-gcm` modes, for others would throw an exception. [String](../data-types/string.md#string).
**Returned value**
-- Decrypted String. [String](../../sql-reference/data-types/string.md#string).
+- Decrypted String. [String](../data-types/string.md#string).
**Examples**
@@ -361,14 +361,14 @@ aes_decrypt_mysql('mode', 'ciphertext', 'key' [, iv])
**Arguments**
-- `mode` — Decryption mode. [String](../../sql-reference/data-types/string.md#string).
-- `ciphertext` — Encrypted text that needs to be decrypted. [String](../../sql-reference/data-types/string.md#string).
-- `key` — Decryption key. [String](../../sql-reference/data-types/string.md#string).
-- `iv` — Initialization vector. Optional. [String](../../sql-reference/data-types/string.md#string).
+- `mode` — Decryption mode. [String](../data-types/string.md#string).
+- `ciphertext` — Encrypted text that needs to be decrypted. [String](../data-types/string.md#string).
+- `key` — Decryption key. [String](../data-types/string.md#string).
+- `iv` — Initialization vector. Optional. [String](../data-types/string.md#string).
**Returned value**
-- Decrypted String. [String](../../sql-reference/data-types/string.md#string).
+- Decrypted String. [String](../data-types/string.md#string).
**Examples**
diff --git a/docs/en/sql-reference/functions/ext-dict-functions.md b/docs/en/sql-reference/functions/ext-dict-functions.md
index 4149afce044..82c21ce40c8 100644
--- a/docs/en/sql-reference/functions/ext-dict-functions.md
+++ b/docs/en/sql-reference/functions/ext-dict-functions.md
@@ -25,9 +25,9 @@ dictGetOrNull('dict_name', attr_name, id_expr)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `attr_names` — Name of the column of the dictionary, [String literal](../../sql-reference/syntax.md#syntax-string-literal), or tuple of column names, [Tuple](../../sql-reference/data-types/tuple.md)([String literal](../../sql-reference/syntax.md#syntax-string-literal)).
-- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning dictionary key-type value or [Tuple](../../sql-reference/data-types/tuple.md)-type value depending on the dictionary configuration.
-- `default_value_expr` — Values returned if the dictionary does not contain a row with the `id_expr` key. [Expression](../../sql-reference/syntax.md#syntax-expressions) or [Tuple](../../sql-reference/data-types/tuple.md)([Expression](../../sql-reference/syntax.md#syntax-expressions)), returning the value (or values) in the data types configured for the `attr_names` attribute.
+- `attr_names` — Name of the column of the dictionary, [String literal](../../sql-reference/syntax.md#syntax-string-literal), or tuple of column names, [Tuple](../data-types/tuple.md)([String literal](../../sql-reference/syntax.md#syntax-string-literal)).
+- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning dictionary key-type value or [Tuple](../data-types/tuple.md)-type value depending on the dictionary configuration.
+- `default_value_expr` — Values returned if the dictionary does not contain a row with the `id_expr` key. [Expression](../../sql-reference/syntax.md#syntax-expressions) or [Tuple](../data-types/tuple.md)([Expression](../../sql-reference/syntax.md#syntax-expressions)), returning the value (or values) in the data types configured for the `attr_names` attribute.
**Returned value**
@@ -239,14 +239,12 @@ dictHas('dict_name', id_expr)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning dictionary key-type value or [Tuple](../../sql-reference/data-types/tuple.md)-type value depending on the dictionary configuration.
+- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning dictionary key-type value or [Tuple](../data-types/tuple.md)-type value depending on the dictionary configuration.
**Returned value**
-- 0, if there is no key.
-- 1, if there is a key.
-
-Type: `UInt8`.
+- 0, if there is no key. [UInt8](../data-types/int-uint.md).
+- 1, if there is a key. [UInt8](../data-types/int-uint.md).
## dictGetHierarchy
@@ -261,13 +259,11 @@ dictGetHierarchy('dict_name', key)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md)-type value.
+- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md)-type value.
**Returned value**
-- Parents for the key.
-
-Type: [Array(UInt64)](../../sql-reference/data-types/array.md).
+- Parents for the key. [Array(UInt64)](../data-types/array.md).
## dictIsIn
@@ -280,15 +276,13 @@ dictIsIn('dict_name', child_id_expr, ancestor_id_expr)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `child_id_expr` — Key to be checked. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md)-type value.
-- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` key. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md)-type value.
+- `child_id_expr` — Key to be checked. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md)-type value.
+- `ancestor_id_expr` — Alleged ancestor of the `child_id_expr` key. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md)-type value.
**Returned value**
-- 0, if `child_id_expr` is not a child of `ancestor_id_expr`.
-- 1, if `child_id_expr` is a child of `ancestor_id_expr` or if `child_id_expr` is an `ancestor_id_expr`.
-
-Type: `UInt8`.
+- 0, if `child_id_expr` is not a child of `ancestor_id_expr`. [UInt8](../data-types/int-uint.md).
+- 1, if `child_id_expr` is a child of `ancestor_id_expr` or if `child_id_expr` is an `ancestor_id_expr`. [UInt8](../data-types/int-uint.md).
## dictGetChildren
@@ -303,13 +297,11 @@ dictGetChildren(dict_name, key)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md)-type value.
+- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md)-type value.
**Returned values**
-- First-level descendants for the key.
-
-Type: [Array](../../sql-reference/data-types/array.md)([UInt64](../../sql-reference/data-types/int-uint.md)).
+- First-level descendants for the key. [Array](../data-types/array.md)([UInt64](../data-types/int-uint.md)).
**Example**
@@ -352,14 +344,12 @@ dictGetDescendants(dict_name, key, level)
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md)-type value.
-- `level` — Hierarchy level. If `level = 0` returns all descendants to the end. [UInt8](../../sql-reference/data-types/int-uint.md).
+- `key` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md)-type value.
+- `level` — Hierarchy level. If `level = 0` returns all descendants to the end. [UInt8](../data-types/int-uint.md).
**Returned values**
-- Descendants for the key.
-
-Type: [Array](../../sql-reference/data-types/array.md)([UInt64](../../sql-reference/data-types/int-uint.md)).
+- Descendants for the key. [Array](../data-types/array.md)([UInt64](../data-types/int-uint.md)).
**Example**
@@ -419,8 +409,8 @@ dictGetAll('dict_name', attr_names, id_expr[, limit])
**Arguments**
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `attr_names` — Name of the column of the dictionary, [String literal](../../sql-reference/syntax.md#syntax-string-literal), or tuple of column names, [Tuple](../../sql-reference/data-types/tuple.md)([String literal](../../sql-reference/syntax.md#syntax-string-literal)).
-- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning array of dictionary key-type value or [Tuple](../../sql-reference/data-types/tuple.md)-type value depending on the dictionary configuration.
+- `attr_names` — Name of the column of the dictionary, [String literal](../../sql-reference/syntax.md#syntax-string-literal), or tuple of column names, [Tuple](../data-types/tuple.md)([String literal](../../sql-reference/syntax.md#syntax-string-literal)).
+- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning array of dictionary key-type value or [Tuple](../data-types/tuple.md)-type value depending on the dictionary configuration.
- `limit` - Maximum length for each value array returned. When truncating, child nodes are given precedence over parent nodes, and otherwise the defined list order for the regexp tree dictionary is respected. If unspecified, array length is unlimited.
**Returned value**
@@ -509,7 +499,7 @@ dictGet[Type]OrDefault('dict_name', 'attr_name', id_expr, default_value_expr)
- `dict_name` — Name of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
- `attr_name` — Name of the column of the dictionary. [String literal](../../sql-reference/syntax.md#syntax-string-literal).
-- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../../sql-reference/data-types/int-uint.md) or [Tuple](../../sql-reference/data-types/tuple.md)-type value depending on the dictionary configuration.
+- `id_expr` — Key value. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning a [UInt64](../data-types/int-uint.md) or [Tuple](../data-types/tuple.md)-type value depending on the dictionary configuration.
- `default_value_expr` — Value returned if the dictionary does not contain a row with the `id_expr` key. [Expression](../../sql-reference/syntax.md#syntax-expressions) returning the value in the data type configured for the `attr_name` attribute.
**Returned value**
diff --git a/docs/en/sql-reference/functions/files.md b/docs/en/sql-reference/functions/files.md
index d62cd1db88d..ac9e21cd416 100644
--- a/docs/en/sql-reference/functions/files.md
+++ b/docs/en/sql-reference/functions/files.md
@@ -19,7 +19,7 @@ file(path[, default])
**Arguments**
- `path` — The path of the file relative to [user_files_path](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-user_files_path). Supports wildcards `*`, `**`, `?`, `{abc,def}` and `{N..M}` where `N`, `M` are numbers and `'abc', 'def'` are strings.
-- `default` — The value returned if the file does not exist or cannot be accessed. Supported data types: [String](../../sql-reference/data-types/string.md) and [NULL](../../sql-reference/syntax.md#null-literal).
+- `default` — The value returned if the file does not exist or cannot be accessed. Supported data types: [String](../data-types/string.md) and [NULL](../../sql-reference/syntax.md#null-literal).
**Example**
diff --git a/docs/en/sql-reference/functions/functions-for-nulls.md b/docs/en/sql-reference/functions/functions-for-nulls.md
index 90520145b9d..a0dfbebc8ae 100644
--- a/docs/en/sql-reference/functions/functions-for-nulls.md
+++ b/docs/en/sql-reference/functions/functions-for-nulls.md
@@ -351,7 +351,7 @@ Result:
## assumeNotNull
-Returns the corresponding non-`Nullable` value for a value of [Nullable](../../sql-reference/data-types/nullable.md) type. If the original value is `NULL`, an arbitrary result can be returned. See also functions `ifNull` and `coalesce`.
+Returns the corresponding non-`Nullable` value for a value of [Nullable](../data-types/nullable.md) type. If the original value is `NULL`, an arbitrary result can be returned. See also functions `ifNull` and `coalesce`.
``` sql
assumeNotNull(x)
diff --git a/docs/en/sql-reference/functions/geo/coordinates.md b/docs/en/sql-reference/functions/geo/coordinates.md
index 1cbc1933206..d10573b8995 100644
--- a/docs/en/sql-reference/functions/geo/coordinates.md
+++ b/docs/en/sql-reference/functions/geo/coordinates.md
@@ -152,8 +152,8 @@ pointInPolygon((x, y), [(a, b), (c, d) ...], ...)
**Input values**
-- `(x, y)` — Coordinates of a point on the plane. Data type — [Tuple](../../../sql-reference/data-types/tuple.md) — A tuple of two numbers.
-- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Array](../../../sql-reference/data-types/array.md). Each vertex is represented by a pair of coordinates `(a, b)`. Vertices should be specified in a clockwise or counterclockwise order. The minimum number of vertices is 3. The polygon must be constant.
+- `(x, y)` — Coordinates of a point on the plane. Data type — [Tuple](../../data-types/tuple.md) — A tuple of two numbers.
+- `[(a, b), (c, d) ...]` — Polygon vertices. Data type — [Array](../../data-types/array.md). Each vertex is represented by a pair of coordinates `(a, b)`. Vertices should be specified in a clockwise or counterclockwise order. The minimum number of vertices is 3. The polygon must be constant.
- The function also supports polygons with holes (cut out sections). In this case, add polygons that define the cut out sections using additional arguments of the function. The function does not support non-simply-connected polygons.
**Returned values**
diff --git a/docs/en/sql-reference/functions/geo/geohash.md b/docs/en/sql-reference/functions/geo/geohash.md
index ce16af44e90..8abc8006e5d 100644
--- a/docs/en/sql-reference/functions/geo/geohash.md
+++ b/docs/en/sql-reference/functions/geo/geohash.md
@@ -74,11 +74,11 @@ geohashesInBox(longitude_min, latitude_min, longitude_max, latitude_max, precisi
**Arguments**
-- `longitude_min` — Minimum longitude. Range: `[-180°, 180°]`. Type: [Float](../../../sql-reference/data-types/float.md).
-- `latitude_min` — Minimum latitude. Range: `[-90°, 90°]`. Type: [Float](../../../sql-reference/data-types/float.md).
-- `longitude_max` — Maximum longitude. Range: `[-180°, 180°]`. Type: [Float](../../../sql-reference/data-types/float.md).
-- `latitude_max` — Maximum latitude. Range: `[-90°, 90°]`. Type: [Float](../../../sql-reference/data-types/float.md).
-- `precision` — Geohash precision. Range: `[1, 12]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `longitude_min` — Minimum longitude. Range: `[-180°, 180°]`. [Float](../../data-types/float.md).
+- `latitude_min` — Minimum latitude. Range: `[-90°, 90°]`. [Float](../../data-types/float.md).
+- `longitude_max` — Maximum longitude. Range: `[-180°, 180°]`. [Float](../../data-types/float.md).
+- `latitude_max` — Maximum latitude. Range: `[-90°, 90°]`. [Float](../../data-types/float.md).
+- `precision` — Geohash precision. Range: `[1, 12]`. [UInt8](../../data-types/int-uint.md).
:::note
All coordinate parameters must be of the same type: either `Float32` or `Float64`.
@@ -86,11 +86,9 @@ All coordinate parameters must be of the same type: either `Float32` or `Float64
**Returned values**
-- Array of precision-long strings of geohash-boxes covering provided area, you should not rely on order of items.
+- Array of precision-long strings of geohash-boxes covering provided area, you should not rely on order of items. [Array](../../data-types/array.md)([String](../../data-types/string.md)).
- `[]` - Empty array if minimum latitude and longitude values aren’t less than corresponding maximum values.
-Type: [Array](../../../sql-reference/data-types/array.md)([String](../../../sql-reference/data-types/string.md)).
-
:::note
Function throws an exception if resulting array is over 10’000’000 items long.
:::
diff --git a/docs/en/sql-reference/functions/geo/h3.md b/docs/en/sql-reference/functions/geo/h3.md
index 29486c58e6a..bcdd457964a 100644
--- a/docs/en/sql-reference/functions/geo/h3.md
+++ b/docs/en/sql-reference/functions/geo/h3.md
@@ -26,14 +26,12 @@ h3IsValid(h3index)
**Parameter**
-- `h3index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `h3index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- 1 — The number is a valid H3 index.
-- 0 — The number is not a valid H3 index.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- 1 — The number is a valid H3 index. [UInt8](../../data-types/int-uint.md).
+- 0 — The number is not a valid H3 index. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -63,14 +61,12 @@ h3GetResolution(h3index)
**Parameter**
-- `h3index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `h3index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- Index resolution. Range: `[0, 15]`.
-- If the index is not valid, the function returns a random value. Use [h3IsValid](#h3isvalid) to verify the index.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
+- If the index is not valid, the function returns a random value. Use [h3IsValid](#h3isvalid) to verify the index. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -100,11 +96,11 @@ h3EdgeAngle(resolution)
**Parameter**
-- `resolution` — Index resolution. Type: [UInt8](../../../sql-reference/data-types/int-uint.md). Range: `[0, 15]`.
+- `resolution` — Index resolution. [UInt8](../../data-types/int-uint.md). Range: `[0, 15]`.
**Returned values**
-- The average length of the [H3](#h3index) hexagon edge in grades. Type: [Float64](../../../sql-reference/data-types/float.md).
+- The average length of the [H3](#h3index) hexagon edge in grades. [Float64](../../data-types/float.md).
**Example**
@@ -134,11 +130,11 @@ h3EdgeLengthM(resolution)
**Parameter**
-- `resolution` — Index resolution. Type: [UInt8](../../../sql-reference/data-types/int-uint.md). Range: `[0, 15]`.
+- `resolution` — Index resolution. [UInt8](../../data-types/int-uint.md). Range: `[0, 15]`.
**Returned values**
-- The average length of the [H3](#h3index) hexagon edge in meters. Type: [Float64](../../../sql-reference/data-types/float.md).
+- The average length of the [H3](#h3index) hexagon edge in meters. [Float64](../../data-types/float.md).
**Example**
@@ -168,11 +164,11 @@ h3EdgeLengthKm(resolution)
**Parameter**
-- `resolution` — Index resolution. Type: [UInt8](../../../sql-reference/data-types/int-uint.md). Range: `[0, 15]`.
+- `resolution` — Index resolution. [UInt8](../../data-types/int-uint.md). Range: `[0, 15]`.
**Returned values**
-- The average length of the [H3](#h3index) hexagon edge in kilometers. Type: [Float64](../../../sql-reference/data-types/float.md).
+- The average length of the [H3](#h3index) hexagon edge in kilometers. [Float64](../../data-types/float.md).
**Example**
@@ -202,16 +198,14 @@ geoToH3(lon, lat, resolution)
**Arguments**
-- `lon` — Longitude. Type: [Float64](../../../sql-reference/data-types/float.md).
-- `lat` — Latitude. Type: [Float64](../../../sql-reference/data-types/float.md).
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `lon` — Longitude. [Float64](../../data-types/float.md).
+- `lat` — Latitude. [Float64](../../data-types/float.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned values**
-- Hexagon index number.
-- 0 in case of error.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- 0 in case of error. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -241,11 +235,11 @@ h3ToGeo(h3Index)
**Arguments**
-- `h3Index` — H3 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `h3Index` — H3 Index. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- A tuple consisting of two values: `tuple(lon,lat)`. `lon` — Longitude. [Float64](../../../sql-reference/data-types/float.md). `lat` — Latitude. [Float64](../../../sql-reference/data-types/float.md).
+- A tuple consisting of two values: `tuple(lon,lat)`. `lon` — Longitude. [Float64](../../data-types/float.md). `lat` — Latitude. [Float64](../../data-types/float.md).
**Example**
@@ -275,12 +269,11 @@ h3ToGeoBoundary(h3Index)
**Arguments**
-- `h3Index` — H3 Index. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `h3Index` — H3 Index. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- Array of pairs '(lon, lat)'.
-Type: [Array](../../../sql-reference/data-types/array.md)([Float64](../../../sql-reference/data-types/float.md), [Float64](../../../sql-reference/data-types/float.md)).
+- Array of pairs '(lon, lat)'. [Array](../../data-types/array.md)([Float64](../../data-types/float.md), [Float64](../../data-types/float.md)).
**Example**
@@ -311,14 +304,12 @@ h3kRing(h3index, k)
**Arguments**
-- `h3index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `k` — Radius. Type: [integer](../../../sql-reference/data-types/int-uint.md)
+- `h3index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `k` — Radius. [integer](../../data-types/int-uint.md)
**Returned values**
-- Array of H3 indexes.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array of H3 indexes. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -354,13 +345,11 @@ h3GetBaseCell(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Hexagon base cell number.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- Hexagon base cell number. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -390,13 +379,11 @@ h3HexAreaM2(resolution)
**Parameter**
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned value**
-- Area in square meters.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Area in square meters. [Float64](../../data-types/float.md).
**Example**
@@ -426,13 +413,11 @@ h3HexAreaKm2(resolution)
**Parameter**
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned value**
-- Area in square kilometers.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Area in square kilometers. [Float64](../../data-types/float.md).
**Example**
@@ -462,15 +447,13 @@ h3IndexesAreNeighbors(index1, index2)
**Arguments**
-- `index1` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `index2` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index1` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `index2` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- `1` — Indexes are neighbours.
-- `0` — Indexes are not neighbours.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `1` — Indexes are neighbours. [UInt8](../../data-types/int-uint.md).
+- `0` — Indexes are not neighbours. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -500,14 +483,12 @@ h3ToChildren(index, resolution)
**Arguments**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned values**
-- Array of the child H3-indexes.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array of the child H3-indexes. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -537,14 +518,12 @@ h3ToParent(index, resolution)
**Arguments**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned value**
-- Parent H3 index.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Parent H3 index. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -572,13 +551,11 @@ h3ToString(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- String representation of the H3 index.
-
-Type: [String](../../../sql-reference/data-types/string.md).
+- String representation of the H3 index. [String](../../data-types/string.md).
**Example**
@@ -608,11 +585,11 @@ stringToH3(index_str)
**Parameter**
-- `index_str` — String representation of the H3 index. Type: [String](../../../sql-reference/data-types/string.md).
+- `index_str` — String representation of the H3 index. [String](../../data-types/string.md).
**Returned value**
-- Hexagon index number. Returns 0 on error. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Hexagon index number. Returns 0 on error. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -642,11 +619,11 @@ h3GetResolution(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -676,14 +653,12 @@ h3IsResClassIII(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- `1` — Index has a resolution with Class III orientation.
-- `0` — Index doesn't have a resolution with Class III orientation.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `1` — Index has a resolution with Class III orientation. [UInt8](../../data-types/int-uint.md).
+- `0` — Index doesn't have a resolution with Class III orientation. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -713,14 +688,12 @@ h3IsPentagon(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- `1` — Index represents a pentagonal cell.
-- `0` — Index doesn't represent a pentagonal cell.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `1` — Index represents a pentagonal cell. [UInt8](../../data-types/int-uint.md).
+- `0` — Index doesn't represent a pentagonal cell. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -750,13 +723,11 @@ h3GetFaces(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- Array containing icosahedron faces intersected by a given H3 index.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array containing icosahedron faces intersected by a given H3 index. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -786,13 +757,11 @@ h3CellAreaM2(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Cell area in square meters.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Cell area in square meters. [Float64](../../data-types/float.md).
**Example**
@@ -822,13 +791,11 @@ h3CellAreaRads2(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Cell area in square radians.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Cell area in square radians. [Float64](../../data-types/float.md).
**Example**
@@ -858,14 +825,12 @@ h3ToCenterChild(index, resolution)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned values**
-- [H3](#h3index) index of the center child contained by given [H3](#h3index) at the given resolution.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- [H3](#h3index) index of the center child contained by given [H3](#h3index) at the given resolution. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -895,13 +860,11 @@ h3ExactEdgeLengthM(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Exact edge length in meters.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Exact edge length in meters. [Float64](../../data-types/float.md).
**Example**
@@ -931,13 +894,11 @@ h3ExactEdgeLengthKm(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Exact edge length in kilometers.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Exact edge length in kilometers. [Float64](../../data-types/float.md).
**Example**
@@ -967,13 +928,11 @@ h3ExactEdgeLengthRads(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Exact edge length in radians.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Exact edge length in radians. [Float64](../../data-types/float.md).
**Example**
@@ -1003,13 +962,11 @@ h3NumHexagons(resolution)
**Parameter**
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned value**
-- Number of H3 indices.
-
-Type: [Int64](../../../sql-reference/data-types/int-uint.md).
+- Number of H3 indices. [Int64](../../data-types/int-uint.md).
**Example**
@@ -1039,14 +996,12 @@ h3PointDistM(lat1, lon1, lat2, lon2)
**Arguments**
-- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
-- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
+- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. [Float64](../../data-types/float.md).
+- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. [Float64](../../data-types/float.md).
**Returned values**
-- Haversine or great circle distance in meters.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Haversine or great circle distance in meters.[Float64](../../data-types/float.md).
**Example**
@@ -1076,14 +1031,12 @@ h3PointDistKm(lat1, lon1, lat2, lon2)
**Arguments**
-- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
-- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
+- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. [Float64](../../data-types/float.md).
+- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. [Float64](../../data-types/float.md).
**Returned values**
-- Haversine or great circle distance in kilometers.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Haversine or great circle distance in kilometers. [Float64](../../data-types/float.md).
**Example**
@@ -1113,14 +1066,12 @@ h3PointDistRads(lat1, lon1, lat2, lon2)
**Arguments**
-- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
-- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. Type: [Float64](../../../sql-reference/data-types/float.md).
+- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. [Float64](../../data-types/float.md).
+- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. [Float64](../../data-types/float.md).
**Returned values**
-- Haversine or great circle distance in radians.
-
-Type: [Float64](../../../sql-reference/data-types/float.md).
+- Haversine or great circle distance in radians. [Float64](../../data-types/float.md).
**Example**
@@ -1150,9 +1101,7 @@ h3GetRes0Indexes()
**Returned values**
-- Array of all the resolution 0 H3 indexes.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array of all the resolution 0 H3 indexes. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -1183,13 +1132,11 @@ h3GetPentagonIndexes(resolution)
**Parameter**
-- `resolution` — Index resolution. Range: `[0, 15]`. Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](../../data-types/int-uint.md).
**Returned value**
-- Array of all pentagon H3 indexes.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array of all pentagon H3 indexes. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -1219,14 +1166,12 @@ h3Line(start,end)
**Parameter**
-- `start` — Hexagon index number that represents a starting point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `end` — Hexagon index number that represents an ending point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `start` — Hexagon index number that represents a starting point. [UInt64](../../data-types/int-uint.md).
+- `end` — Hexagon index number that represents an ending point. [UInt64](../../data-types/int-uint.md).
**Returned value**
-Array of h3 indexes representing the line of indices between the two provided indices:
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+Array of h3 indexes representing the line of indices between the two provided indices. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -1256,14 +1201,12 @@ h3Distance(start,end)
**Parameter**
-- `start` — Hexagon index number that represents a starting point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `end` — Hexagon index number that represents an ending point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `start` — Hexagon index number that represents a starting point. [UInt64](../../data-types/int-uint.md).
+- `end` — Hexagon index number that represents an ending point. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Number of grid cells.
-
-Type: [Int64](../../../sql-reference/data-types/int-uint.md).
+- Number of grid cells. [Int64](../../data-types/int-uint.md).
Returns a negative number if finding the distance fails.
@@ -1297,14 +1240,12 @@ h3HexRing(index, k)
**Parameter**
-- `index` — Hexagon index number that represents the origin. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `k` — Distance. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number that represents the origin. [UInt64](../../data-types/int-uint.md).
+- `k` — Distance. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- Array of H3 indexes.
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+- Array of H3 indexes. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -1334,14 +1275,12 @@ h3GetUnidirectionalEdge(originIndex, destinationIndex)
**Parameter**
-- `originIndex` — Origin Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `destinationIndex` — Destination Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `originIndex` — Origin Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `destinationIndex` — Destination Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Unidirectional Edge Hexagon Index number.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Unidirectional Edge Hexagon Index number. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -1371,14 +1310,12 @@ h3UnidirectionalEdgeisValid(index)
**Parameter**
-- `index` — Hexagon index number. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- 1 — The H3 index is a valid unidirectional edge.
-- 0 — The H3 index is not a valid unidirectional edge.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- 1 — The H3 index is a valid unidirectional edge. [UInt8](../../data-types/int-uint.md).
+- 0 — The H3 index is not a valid unidirectional edge. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -1408,13 +1345,11 @@ h3GetOriginIndexFromUnidirectionalEdge(edge)
**Parameter**
-- `edge` — Hexagon index number that represents a unidirectional edge. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `edge` — Hexagon index number that represents a unidirectional edge. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Origin Hexagon Index number.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Origin Hexagon Index number. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -1444,13 +1379,11 @@ h3GetDestinationIndexFromUnidirectionalEdge(edge)
**Parameter**
-- `edge` — Hexagon index number that represents a unidirectional edge. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `edge` — Hexagon index number that represents a unidirectional edge. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Destination Hexagon Index number.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- Destination Hexagon Index number. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -1480,14 +1413,14 @@ h3GetIndexesFromUnidirectionalEdge(edge)
**Parameter**
-- `edge` — Hexagon index number that represents a unidirectional edge. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `edge` — Hexagon index number that represents a unidirectional edge. [UInt64](../../data-types/int-uint.md).
**Returned value**
A tuple consisting of two values `tuple(origin,destination)`:
-- `origin` — Origin Hexagon index number. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `destination` — Destination Hexagon index number. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `origin` — Origin Hexagon index number. [UInt64](../../data-types/int-uint.md).
+- `destination` — Destination Hexagon index number. [UInt64](../../data-types/int-uint.md).
Returns `(0,0)` if the provided input is not valid.
@@ -1519,13 +1452,11 @@ h3GetUnidirectionalEdgesFromHexagon(index)
**Parameter**
-- `index` — Hexagon index number that represents a unidirectional edge. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number that represents a unidirectional edge. [UInt64](../../data-types/int-uint.md).
**Returned value**
-Array of h3 indexes representing each unidirectional edge:
-
-Type: [Array](../../../sql-reference/data-types/array.md)([UInt64](../../../sql-reference/data-types/int-uint.md)).
+Array of h3 indexes representing each unidirectional edge. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -1555,12 +1486,11 @@ h3GetUnidirectionalEdgeBoundary(index)
**Parameter**
-- `index` — Hexagon index number that represents a unidirectional edge. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `index` — Hexagon index number that represents a unidirectional edge. [UInt64](../../data-types/int-uint.md).
**Returned value**
-- Array of pairs '(lon, lat)'.
- Type: [Array](../../../sql-reference/data-types/array.md)([Float64](../../../sql-reference/data-types/float.md), [Float64](../../../sql-reference/data-types/float.md)).
+- Array of pairs '(lon, lat)'. [Array](../../data-types/array.md)([Float64](../../data-types/float.md), [Float64](../../data-types/float.md)).
**Example**
diff --git a/docs/en/sql-reference/functions/geo/s2.md b/docs/en/sql-reference/functions/geo/s2.md
index f4702eff44b..3165b21318b 100644
--- a/docs/en/sql-reference/functions/geo/s2.md
+++ b/docs/en/sql-reference/functions/geo/s2.md
@@ -21,14 +21,12 @@ geoToS2(lon, lat)
**Arguments**
-- `lon` — Longitude. [Float64](../../../sql-reference/data-types/float.md).
-- `lat` — Latitude. [Float64](../../../sql-reference/data-types/float.md).
+- `lon` — Longitude. [Float64](../../data-types/float.md).
+- `lat` — Latitude. [Float64](../../data-types/float.md).
**Returned values**
-- S2 point index.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- S2 point index. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -58,13 +56,13 @@ s2ToGeo(s2index)
**Arguments**
-- `s2index` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2index` — S2 Index. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- A tuple consisting of two values: `tuple(lon,lat)`.
-
-Type: `lon` — [Float64](../../../sql-reference/data-types/float.md). `lat` — [Float64](../../../sql-reference/data-types/float.md).
+- A [tuple](../../data-types/tuple.md) consisting of two values:
+ - `lon`. [Float64](../../data-types/float.md).
+ - `lat`. [Float64](../../data-types/float.md).
**Example**
@@ -94,13 +92,11 @@ s2GetNeighbors(s2index)
**Arguments**
-- `s2index` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2index` — S2 Index. [UInt64](../../data-types/int-uint.md).
-**Returned values**
+**Returned value**
-- An array consisting of 4 neighbor indexes: `array[s2index1, s2index3, s2index2, s2index4]`.
-
-Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- An array consisting of 4 neighbor indexes: `array[s2index1, s2index3, s2index2, s2index4]`. [Array](../../data-types/array.md)([UInt64](../../data-types/int-uint.md)).
**Example**
@@ -130,14 +126,12 @@ s2CellsIntersect(s2index1, s2index2)
**Arguments**
-- `siIndex1`, `s2index2` — S2 Index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `siIndex1`, `s2index2` — S2 Index. [UInt64](../../data-types/int-uint.md).
-**Returned values**
+**Returned value**
-- 1 — If the cells intersect.
-- 0 — If the cells don't intersect.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `1` — If the cells intersect. [UInt8](../../data-types/int-uint.md).
+- `0` — If the cells don't intersect. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -167,16 +161,14 @@ s2CapContains(center, degrees, point)
**Arguments**
-- `center` — S2 point index corresponding to the cap. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `degrees` — Radius of the cap in degrees. [Float64](../../../sql-reference/data-types/float.md).
-- `point` — S2 point index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `center` — S2 point index corresponding to the cap. [UInt64](../../data-types/int-uint.md).
+- `degrees` — Radius of the cap in degrees. [Float64](../../data-types/float.md).
+- `point` — S2 point index. [UInt64](../../data-types/int-uint.md).
-**Returned values**
+**Returned value**
-- 1 — If the cap contains the S2 point index.
-- 0 — If the cap doesn't contain the S2 point index.
-
-Type: [UInt8](../../../sql-reference/data-types/int-uint.md).
+- `1` — If the cap contains the S2 point index. [UInt8](../../data-types/int-uint.md).
+- `0` — If the cap doesn't contain the S2 point index. [UInt8](../../data-types/int-uint.md).
**Example**
@@ -206,13 +198,13 @@ s2CapUnion(center1, radius1, center2, radius2)
**Arguments**
-- `center1`, `center2` — S2 point indexes corresponding to the two input caps. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `radius1`, `radius2` — Radius of the two input caps in degrees. [Float64](../../../sql-reference/data-types/float.md).
+- `center1`, `center2` — S2 point indexes corresponding to the two input caps. [UInt64](../../data-types/int-uint.md).
+- `radius1`, `radius2` — Radius of the two input caps in degrees. [Float64](../../data-types/float.md).
**Returned values**
-- `center` — S2 point index corresponding the center of the smallest cap containing the two input caps. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `radius` — Radius of the smallest cap containing the two input caps. Type: [Float64](../../../sql-reference/data-types/float.md).
+- `center` — S2 point index corresponding the center of the smallest cap containing the two input caps. [UInt64](../../data-types/int-uint.md).
+- `radius` — Radius of the smallest cap containing the two input caps. [Float64](../../data-types/float.md).
**Example**
@@ -242,14 +234,14 @@ s2RectAdd(s2pointLow, s2pointHigh, s2Point)
**Arguments**
-- `s2PointLow` — Low S2 point index corresponding to the rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2PointHigh` — High S2 point index corresponding to the rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2Point` — Target S2 point index that the bound rectangle should be grown to include. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2PointLow` — Low S2 point index corresponding to the rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2PointHigh` — High S2 point index corresponding to the rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2Point` — Target S2 point index that the bound rectangle should be grown to include. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- `s2PointLow` — Low S2 cell id corresponding to the grown rectangle. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2PointHigh` — Height S2 cell id corresponding to the grown rectangle. Type: [UInt64](../../../sql-reference/data-types/float.md).
+- `s2PointLow` — Low S2 cell id corresponding to the grown rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2PointHigh` — Height S2 cell id corresponding to the grown rectangle. [UInt64](../../data-types/float.md).
**Example**
@@ -279,14 +271,14 @@ s2RectContains(s2PointLow, s2PointHi, s2Point)
**Arguments**
-- `s2PointLow` — Low S2 point index corresponding to the rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2PointHigh` — High S2 point index corresponding to the rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2Point` — Target S2 point index. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2PointLow` — Low S2 point index corresponding to the rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2PointHigh` — High S2 point index corresponding to the rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2Point` — Target S2 point index. [UInt64](../../data-types/int-uint.md).
-**Returned values**
+**Returned value**
-- 1 — If the rectangle contains the given S2 point.
-- 0 — If the rectangle doesn't contain the given S2 point.
+- `1` — If the rectangle contains the given S2 point.
+- `0` — If the rectangle doesn't contain the given S2 point.
**Example**
@@ -316,13 +308,13 @@ s2RectUnion(s2Rect1PointLow, s2Rect1PointHi, s2Rect2PointLow, s2Rect2PointHi)
**Arguments**
-- `s2Rect1PointLow`, `s2Rect1PointHi` — Low and High S2 point indexes corresponding to the first rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2Rect2PointLow`, `s2Rect2PointHi` — Low and High S2 point indexes corresponding to the second rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2Rect1PointLow`, `s2Rect1PointHi` — Low and High S2 point indexes corresponding to the first rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2Rect2PointLow`, `s2Rect2PointHi` — Low and High S2 point indexes corresponding to the second rectangle. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- `s2UnionRect2PointLow` — Low S2 cell id corresponding to the union rectangle. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2UnionRect2PointHi` — High S2 cell id corresponding to the union rectangle. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2UnionRect2PointLow` — Low S2 cell id corresponding to the union rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2UnionRect2PointHi` — High S2 cell id corresponding to the union rectangle. [UInt64](../../data-types/int-uint.md).
**Example**
@@ -352,13 +344,13 @@ s2RectIntersection(s2Rect1PointLow, s2Rect1PointHi, s2Rect2PointLow, s2Rect2Poin
**Arguments**
-- `s2Rect1PointLow`, `s2Rect1PointHi` — Low and High S2 point indexes corresponding to the first rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2Rect2PointLow`, `s2Rect2PointHi` — Low and High S2 point indexes corresponding to the second rectangle. [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2Rect1PointLow`, `s2Rect1PointHi` — Low and High S2 point indexes corresponding to the first rectangle. [UInt64](../../data-types/int-uint.md).
+- `s2Rect2PointLow`, `s2Rect2PointHi` — Low and High S2 point indexes corresponding to the second rectangle. [UInt64](../../data-types/int-uint.md).
**Returned values**
-- `s2UnionRect2PointLow` — Low S2 cell id corresponding to the rectangle containing the intersection of the given rectangles. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
-- `s2UnionRect2PointHi` — High S2 cell id corresponding to the rectangle containing the intersection of the given rectangles. Type: [UInt64](../../../sql-reference/data-types/int-uint.md).
+- `s2UnionRect2PointLow` — Low S2 cell id corresponding to the rectangle containing the intersection of the given rectangles. [UInt64](../../data-types/int-uint.md).
+- `s2UnionRect2PointHi` — High S2 cell id corresponding to the rectangle containing the intersection of the given rectangles. [UInt64](../../data-types/int-uint.md).
**Example**
diff --git a/docs/en/sql-reference/functions/geo/svg.md b/docs/en/sql-reference/functions/geo/svg.md
index c565d1f9de7..320d4542fee 100644
--- a/docs/en/sql-reference/functions/geo/svg.md
+++ b/docs/en/sql-reference/functions/geo/svg.md
@@ -23,13 +23,11 @@ Aliases: `SVG`, `svg`
**Returned value**
-- The SVG representation of the geometry:
+- The SVG representation of the geometry. [String](../../data-types/string).
- SVG circle
- SVG polygon
- SVG path
-Type: [String](../../data-types/string)
-
**Examples**
**Circle**
diff --git a/docs/en/sql-reference/functions/hash-functions.md b/docs/en/sql-reference/functions/hash-functions.md
index 1cd7eeb7c83..506114038f7 100644
--- a/docs/en/sql-reference/functions/hash-functions.md
+++ b/docs/en/sql-reference/functions/hash-functions.md
@@ -12,7 +12,7 @@ Simhash is a hash function, which returns close hash values for close (similar)
## halfMD5
-[Interprets](/docs/en/sql-reference/functions/type-conversion-functions.md/#type_conversion_functions-reinterpretAsString) all the input parameters as strings and calculates the [MD5](https://en.wikipedia.org/wiki/MD5) hash value for each of them. Then combines hashes, takes the first 8 bytes of the hash of the resulting string, and interprets them as `UInt64` in big-endian byte order.
+[Interprets](../functions/type-conversion-functions.md/#type_conversion_functions-reinterpretAsString) all the input parameters as strings and calculates the [MD5](https://en.wikipedia.org/wiki/MD5) hash value for each of them. Then combines hashes, takes the first 8 bytes of the hash of the resulting string, and interprets them as `UInt64` in big-endian byte order.
```sql
halfMD5(par1, ...)
@@ -23,11 +23,11 @@ Consider using the [sipHash64](#siphash64) function instead.
**Arguments**
-The function takes a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+The function takes a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
**Example**
@@ -61,7 +61,7 @@ sipHash64(par1,...)
This is a cryptographic hash function. It works at least three times faster than the [MD5](#md5) hash function.
-The function [interprets](/docs/en/sql-reference/functions/type-conversion-functions.md/#type_conversion_functions-reinterpretAsString) all the input parameters as strings and calculates the hash value for each of them. It then combines the hashes by the following algorithm:
+The function [interprets](../functions/type-conversion-functions.md/#type_conversion_functions-reinterpretAsString) all the input parameters as strings and calculates the hash value for each of them. It then combines the hashes by the following algorithm:
1. The first and the second hash value are concatenated to an array which is hashed.
2. The previously calculated hash value and the hash of the third input parameter are hashed in a similar way.
@@ -69,11 +69,11 @@ The function [interprets](/docs/en/sql-reference/functions/type-conversion-funct
**Arguments**
-The function takes a variable number of input parameters of any of the [supported data types](/docs/en/sql-reference/data-types/index.md).
+The function takes a variable number of input parameters of any of the [supported data types](../data-types/index.md).
**Returned Value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
Note that the calculated hash values may be equal for the same input values of different argument types. This affects for example integer types of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data.
@@ -105,7 +105,7 @@ Same as [sipHash64](#siphash64), but the first argument is a tuple of two UInt64
**Returned value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
**Example**
@@ -143,7 +143,7 @@ Same as for [sipHash64](#siphash64).
**Returned value**
-A 128-bit `SipHash` hash value of type [FixedString(16)](/docs/en/sql-reference/data-types/fixedstring.md).
+A 128-bit `SipHash` hash value of type [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -183,7 +183,7 @@ Same as [sipHash128](#siphash128), but the first argument is a tuple of two UInt
**Returned value**
-A 128-bit `SipHash` hash value of type [FixedString(16)](/docs/en/sql-reference/data-types/fixedstring.md).
+A 128-bit `SipHash` hash value of type [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -217,7 +217,7 @@ Same as for [sipHash128](#siphash128).
**Returned value**
-A 128-bit `SipHash` hash value of type [FixedString(16)](/docs/en/sql-reference/data-types/fixedstring.md).
+A 128-bit `SipHash` hash value of type [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -251,7 +251,7 @@ Same as [sipHash128Reference](#siphash128reference), but the first argument is a
**Returned value**
-A 128-bit `SipHash` hash value of type [FixedString(16)](/docs/en/sql-reference/data-types/fixedstring.md).
+A 128-bit `SipHash` hash value of type [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -283,11 +283,11 @@ Note that Google changed the algorithm of CityHash after it has been added to Cl
**Arguments**
-The function takes a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+The function takes a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
**Examples**
@@ -321,7 +321,7 @@ It works faster than intHash32. Average quality.
## SHA1, SHA224, SHA256, SHA512, SHA512_256
-Calculates SHA-1, SHA-224, SHA-256, SHA-512, SHA-512-256 hash from a string and returns the resulting set of bytes as [FixedString](/docs/en/sql-reference/data-types/fixedstring.md).
+Calculates SHA-1, SHA-224, SHA-256, SHA-512, SHA-512-256 hash from a string and returns the resulting set of bytes as [FixedString](../data-types/fixedstring.md).
**Syntax**
@@ -337,17 +337,15 @@ Even in these cases, we recommend applying the function offline and pre-calculat
**Arguments**
-- `s` — Input string for SHA hash calculation. [String](/docs/en/sql-reference/data-types/string.md).
+- `s` — Input string for SHA hash calculation. [String](../data-types/string.md).
**Returned value**
-- SHA hash as a hex-unencoded FixedString. SHA-1 returns as FixedString(20), SHA-224 as FixedString(28), SHA-256 — FixedString(32), SHA-512 — FixedString(64).
-
-Type: [FixedString](/docs/en/sql-reference/data-types/fixedstring.md).
+- SHA hash as a hex-unencoded FixedString. SHA-1 returns as FixedString(20), SHA-224 as FixedString(28), SHA-256 — FixedString(32), SHA-512 — FixedString(64). [FixedString](../data-types/fixedstring.md).
**Example**
-Use the [hex](/docs/en/sql-reference/functions/encoding-functions.md/#hex) function to represent the result as a hex-encoded string.
+Use the [hex](../functions/encoding-functions.md/#hex) function to represent the result as a hex-encoded string.
Query:
@@ -365,7 +363,7 @@ Result:
## BLAKE3
-Calculates BLAKE3 hash string and returns the resulting set of bytes as [FixedString](/docs/en/sql-reference/data-types/fixedstring.md).
+Calculates BLAKE3 hash string and returns the resulting set of bytes as [FixedString](../data-types/fixedstring.md).
**Syntax**
@@ -377,17 +375,15 @@ This cryptographic hash-function is integrated into ClickHouse with BLAKE3 Rust
**Arguments**
-- s - input string for BLAKE3 hash calculation. [String](/docs/en/sql-reference/data-types/string.md).
+- s - input string for BLAKE3 hash calculation. [String](../data-types/string.md).
**Return value**
-- BLAKE3 hash as a byte array with type FixedString(32).
-
-Type: [FixedString](/docs/en/sql-reference/data-types/fixedstring.md).
+- BLAKE3 hash as a byte array with type FixedString(32). [FixedString](../data-types/fixedstring.md).
**Example**
-Use function [hex](/docs/en/sql-reference/functions/encoding-functions.md/#hex) to represent the result as a hex-encoded string.
+Use function [hex](../functions/encoding-functions.md/#hex) to represent the result as a hex-encoded string.
Query:
```sql
@@ -423,11 +419,11 @@ These functions use the `Fingerprint64` and `Hash64` methods respectively from a
**Arguments**
-The function takes a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+The function takes a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
**Example**
@@ -540,9 +536,7 @@ This is just [JavaHash](#javahash) with zeroed out sign bit. This function is us
**Returned value**
-A `Int32` data type hash value.
-
-Type: `hiveHash`.
+- `hiveHash` hash value. [Int32](../data-types/int-uint.md).
**Example**
@@ -570,11 +564,11 @@ metroHash64(par1, ...)
**Arguments**
-The function takes a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+The function takes a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-A [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+A [UInt64](../data-types/int-uint.md) data type hash value.
**Example**
@@ -608,12 +602,12 @@ Alias: `yandexConsistentHash` (left for backwards compatibility sake).
**Parameters**
-- `input`: A UInt64-type key [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
-- `n`: Number of buckets. [UInt16](/docs/en/sql-reference/data-types/int-uint.md).
+- `input`: A UInt64-type key [UInt64](../data-types/int-uint.md).
+- `n`: Number of buckets. [UInt16](../data-types/int-uint.md).
**Returned value**
-- A [UInt16](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+- A [UInt16](../data-types/int-uint.md) data type hash value.
**Implementation details**
@@ -644,12 +638,12 @@ murmurHash2_64(par1, ...)
**Arguments**
-Both functions take a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+Both functions take a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-- The `murmurHash2_32` function returns hash value having the [UInt32](/docs/en/sql-reference/data-types/int-uint.md) data type.
-- The `murmurHash2_64` function returns hash value having the [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type.
+- The `murmurHash2_32` function returns hash value having the [UInt32](../data-types/int-uint.md) data type.
+- The `murmurHash2_64` function returns hash value having the [UInt64](../data-types/int-uint.md) data type.
**Example**
@@ -675,13 +669,11 @@ gccMurmurHash(par1, ...)
**Arguments**
-- `par1, ...` — A variable number of parameters that can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md/#data_types).
+- `par1, ...` — A variable number of parameters that can be any of the [supported data types](../data-types/index.md/#data_types).
**Returned value**
-- Calculated hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Calculated hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -714,13 +706,11 @@ MurmurHash(par1, ...)
**Arguments**
-- `par1, ...` — A variable number of parameters that can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md/#data_types).
+- `par1, ...` — A variable number of parameters that can be any of the [supported data types](../data-types/index.md/#data_types).
**Returned value**
-- Calculated hash value.
-
-Type: [UInt32](/docs/en/sql-reference/data-types/int-uint.md).
+- Calculated hash value. [UInt32](../data-types/int-uint.md).
**Example**
@@ -751,12 +741,12 @@ murmurHash3_64(par1, ...)
**Arguments**
-Both functions take a variable number of input parameters. Arguments can be any of the [supported data types](/docs/en/sql-reference/data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
+Both functions take a variable number of input parameters. Arguments can be any of the [supported data types](../data-types/index.md). For some data types calculated value of hash function may be the same for the same values even if types of arguments differ (integers of different size, named and unnamed `Tuple` with the same data, `Map` and the corresponding `Array(Tuple(key, value))` type with the same data).
**Returned Value**
-- The `murmurHash3_32` function returns a [UInt32](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
-- The `murmurHash3_64` function returns a [UInt64](/docs/en/sql-reference/data-types/int-uint.md) data type hash value.
+- The `murmurHash3_32` function returns a [UInt32](../data-types/int-uint.md) data type hash value.
+- The `murmurHash3_64` function returns a [UInt64](../data-types/int-uint.md) data type hash value.
**Example**
@@ -782,13 +772,11 @@ murmurHash3_128(expr)
**Arguments**
-- `expr` — A list of [expressions](/docs/en/sql-reference/syntax.md/#syntax-expressions). [String](/docs/en/sql-reference/data-types/string.md).
+- `expr` — A list of [expressions](../syntax.md/#syntax-expressions). [String](../data-types/string.md).
**Returned value**
-A 128-bit `MurmurHash3` hash value.
-
-Type: [FixedString(16)](/docs/en/sql-reference/data-types/fixedstring.md).
+A 128-bit `MurmurHash3` hash value. [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -818,13 +806,11 @@ xxh3(expr)
**Arguments**
-- `expr` — A list of [expressions](/docs/en/sql-reference/syntax.md/#syntax-expressions) of any data type.
+- `expr` — A list of [expressions](../syntax.md/#syntax-expressions) of any data type.
**Returned value**
-A 64-bit `xxh3` hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+A 64-bit `xxh3` hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -856,9 +842,11 @@ SELECT xxHash64('')
**Returned value**
-A `UInt32` or `UInt64` data type hash value.
+- Hash value. [UInt32/64](../data-types/int-uint.md).
-Type: `UInt32` for `xxHash32` and `UInt64` for `xxHash64`.
+:::note
+The return type will be `UInt32` for `xxHash32` and `UInt64` for `xxHash64`.
+:::
**Example**
@@ -884,7 +872,7 @@ Result:
Splits a ASCII string into n-grams of `ngramsize` symbols and returns the n-gram `simhash`. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -894,14 +882,12 @@ ngramSimHash(string[, ngramsize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -923,7 +909,7 @@ Result:
Splits a ASCII string into n-grams of `ngramsize` symbols and returns the n-gram `simhash`. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -933,14 +919,12 @@ ngramSimHashCaseInsensitive(string[, ngramsize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -962,7 +946,7 @@ Result:
Splits a UTF-8 string into n-grams of `ngramsize` symbols and returns the n-gram `simhash`. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -972,14 +956,12 @@ ngramSimHashUTF8(string[, ngramsize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1001,7 +983,7 @@ Result:
Splits a UTF-8 string into n-grams of `ngramsize` symbols and returns the n-gram `simhash`. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -1011,14 +993,12 @@ ngramSimHashCaseInsensitiveUTF8(string[, ngramsize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1040,7 +1020,7 @@ Result:
Splits a ASCII string into parts (shingles) of `shinglesize` words and returns the word shingle `simhash`. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -1050,14 +1030,12 @@ wordShingleSimHash(string[, shinglesize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1079,7 +1057,7 @@ Result:
Splits a ASCII string into parts (shingles) of `shinglesize` words and returns the word shingle `simhash`. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -1089,14 +1067,12 @@ wordShingleSimHashCaseInsensitive(string[, shinglesize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1118,7 +1094,7 @@ Result:
Splits a UTF-8 string into parts (shingles) of `shinglesize` words and returns the word shingle `simhash`. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -1128,14 +1104,12 @@ wordShingleSimHashUTF8(string[, shinglesize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1157,7 +1131,7 @@ Result:
Splits a UTF-8 string into parts (shingles) of `shinglesize` words and returns the word shingle `simhash`. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [bitHammingDistance](/docs/en/sql-reference/functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
+Can be used for detection of semi-duplicate strings with [bitHammingDistance](../functions/bit-functions.md/#bithammingdistance). The smaller is the [Hamming Distance](https://en.wikipedia.org/wiki/Hamming_distance) of the calculated `simhashes` of two strings, the more likely these strings are the same.
**Syntax**
@@ -1167,14 +1141,12 @@ wordShingleSimHashCaseInsensitiveUTF8(string[, shinglesize])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1204,13 +1176,11 @@ wyHash64(string)
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
+- `string` — String. [String](../data-types/string.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Hash value. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1232,7 +1202,7 @@ Result:
Splits a ASCII string into n-grams of `ngramsize` symbols and calculates hash values for each n-gram. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1242,15 +1212,13 @@ ngramMinHash(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1272,7 +1240,7 @@ Result:
Splits a ASCII string into n-grams of `ngramsize` symbols and calculates hash values for each n-gram. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1282,15 +1250,13 @@ ngramMinHashCaseInsensitive(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1312,7 +1278,7 @@ Result:
Splits a UTF-8 string into n-grams of `ngramsize` symbols and calculates hash values for each n-gram. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1322,15 +1288,13 @@ ngramMinHashUTF8(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1352,7 +1316,7 @@ Result:
Splits a UTF-8 string into n-grams of `ngramsize` symbols and calculates hash values for each n-gram. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1362,15 +1326,13 @@ ngramMinHashCaseInsensitiveUTF8(string [, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1400,15 +1362,13 @@ ngramMinHashArg(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` n-grams each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` n-grams each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1438,15 +1398,13 @@ ngramMinHashArgCaseInsensitive(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` n-grams each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` n-grams each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1476,15 +1434,13 @@ ngramMinHashArgUTF8(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` n-grams each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` n-grams each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1514,15 +1470,13 @@ ngramMinHashArgCaseInsensitiveUTF8(string[, ngramsize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `ngramsize` — The size of an n-gram. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` n-grams each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` n-grams each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1544,7 +1498,7 @@ Result:
Splits a ASCII string into parts (shingles) of `shinglesize` words and calculates hash values for each word shingle. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1554,15 +1508,13 @@ wordShingleMinHash(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1584,7 +1536,7 @@ Result:
Splits a ASCII string into parts (shingles) of `shinglesize` words and calculates hash values for each word shingle. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1594,15 +1546,13 @@ wordShingleMinHashCaseInsensitive(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1624,7 +1574,7 @@ Result:
Splits a UTF-8 string into parts (shingles) of `shinglesize` words and calculates hash values for each word shingle. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case sensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1634,15 +1584,13 @@ wordShingleMinHashUTF8(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1664,7 +1612,7 @@ Result:
Splits a UTF-8 string into parts (shingles) of `shinglesize` words and calculates hash values for each word shingle. Uses `hashnum` minimum hashes to calculate the minimum hash and `hashnum` maximum hashes to calculate the maximum hash. Returns a tuple with these hashes. Is case insensitive.
-Can be used for detection of semi-duplicate strings with [tupleHammingDistance](/docs/en/sql-reference/functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
+Can be used for detection of semi-duplicate strings with [tupleHammingDistance](../functions/tuple-functions.md/#tuplehammingdistance). For two strings: if one of the returned hashes is the same for both strings, we think that those strings are the same.
**Syntax**
@@ -1674,15 +1622,13 @@ wordShingleMinHashCaseInsensitiveUTF8(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two hashes — the minimum and the maximum.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([UInt64](/docs/en/sql-reference/data-types/int-uint.md), [UInt64](/docs/en/sql-reference/data-types/int-uint.md)).
+- Tuple with two hashes — the minimum and the maximum. [Tuple](../data-types/tuple.md)([UInt64](../data-types/int-uint.md), [UInt64](../data-types/int-uint.md)).
**Example**
@@ -1712,15 +1658,13 @@ wordShingleMinHashArg(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` word shingles each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` word shingles each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1750,15 +1694,13 @@ wordShingleMinHashArgCaseInsensitive(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` word shingles each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` word shingles each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1788,15 +1730,13 @@ wordShingleMinHashArgUTF8(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` word shingles each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` word shingles each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1826,15 +1766,13 @@ wordShingleMinHashArgCaseInsensitiveUTF8(string[, shinglesize, hashnum])
**Arguments**
-- `string` — String. [String](/docs/en/sql-reference/data-types/string.md).
-- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md).
+- `shinglesize` — The size of a word shingle. Optional. Possible values: any number from `1` to `25`. Default value: `3`. [UInt8](../data-types/int-uint.md).
+- `hashnum` — The number of minimum and maximum hashes used to calculate the result. Optional. Possible values: any number from `1` to `25`. Default value: `6`. [UInt8](../data-types/int-uint.md).
**Returned value**
-- Tuple with two tuples with `hashnum` word shingles each.
-
-Type: [Tuple](/docs/en/sql-reference/data-types/tuple.md)([Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md)), [Tuple](/docs/en/sql-reference/data-types/tuple.md)([String](/docs/en/sql-reference/data-types/string.md))).
+- Tuple with two tuples with `hashnum` word shingles each. [Tuple](../data-types/tuple.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md)), [Tuple](../data-types/tuple.md)([String](../data-types/string.md))).
**Example**
@@ -1872,7 +1810,7 @@ Alias: `sqid`
**Returned Value**
-A sqid [String](/docs/en/sql-reference/data-types/string.md).
+A sqid [String](../data-types/string.md).
**Example**
@@ -1899,11 +1837,11 @@ sqidDecode(sqid)
**Arguments**
-- A sqid - [String](/docs/en/sql-reference/data-types/string.md)
+- A sqid - [String](../data-types/string.md)
**Returned Value**
-The sqid transformed to numbers [Array(UInt64)](/docs/en/sql-reference/data-types/array.md).
+The sqid transformed to numbers [Array(UInt64)](../data-types/array.md).
**Example**
diff --git a/docs/en/sql-reference/functions/index.md b/docs/en/sql-reference/functions/index.md
index d07a5292431..c0256ba4735 100644
--- a/docs/en/sql-reference/functions/index.md
+++ b/docs/en/sql-reference/functions/index.md
@@ -11,7 +11,7 @@ There are at least\* two types of functions - regular functions (they are just c
In this section we discuss regular functions. For aggregate functions, see the section “Aggregate functions”.
:::note
-There is a third type of function that the [‘arrayJoin’ function](/docs/en/sql-reference/functions/array-join.md) belongs to. And [table functions](/docs/en/sql-reference/table-functions/index.md) can also be mentioned separately.
+There is a third type of function that the [‘arrayJoin’ function](../functions/array-join.md) belongs to. And [table functions](../table-functions/index.md) can also be mentioned separately.
:::
## Strong Typing
@@ -63,4 +63,4 @@ For some functions the first argument (the lambda function) can be omitted. In t
## User Defined Functions (UDFs)
-ClickHouse supports user-defined functions. See [UDFs](/docs/en/sql-reference/functions/udf.md).
+ClickHouse supports user-defined functions. See [UDFs](../functions/udf.md).
diff --git a/docs/en/sql-reference/functions/introspection.md b/docs/en/sql-reference/functions/introspection.md
index 1025b8bdc3d..bec97208843 100644
--- a/docs/en/sql-reference/functions/introspection.md
+++ b/docs/en/sql-reference/functions/introspection.md
@@ -36,16 +36,13 @@ addressToLine(address_of_binary_instruction)
**Arguments**
-- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process.
+- `address_of_binary_instruction` ([UInt64](../data-types/int-uint.md)) — Address of instruction in a running process.
**Returned value**
- Source code filename and the line number in this file delimited by colon.
-
For example, `/build/obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:199`, where `199` is a line number.
-
- Name of a binary, if the function couldn’t find the debug information.
-
- Empty string, if the address is not valid.
Type: [String](../../sql-reference/data-types/string.md).
@@ -117,9 +114,11 @@ trace_source_code_lines: /lib/x86_64-linux-gnu/libpthread-2.27.so
## addressToLineWithInlines
-Similar to `addressToLine`, but it will return an Array with all inline functions, and will be much slower as a price.
+Similar to `addressToLine`, but returns an Array with all inline functions. As a result of this, it is slower than `addressToLine`.
+:::note
If you use official ClickHouse packages, you need to install the `clickhouse-common-static-dbg` package.
+:::
**Syntax**
@@ -129,17 +128,11 @@ addressToLineWithInlines(address_of_binary_instruction)
**Arguments**
-- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process.
+- `address_of_binary_instruction` ([UInt64](../data-types/int-uint.md)) — Address of instruction in a running process.
**Returned value**
-- Array which first element is source code filename and the line number in this file delimited by colon. And from second element, inline functions' source code filename and line number and function name are listed.
-
-- Array with single element which is name of a binary, if the function couldn’t find the debug information.
-
-- Empty array, if the address is not valid.
-
-Type: [Array(String)](../../sql-reference/data-types/array.md).
+- An array whose first element is the source code filename and line number in the file delimited by a colon. From the second element onwards, inline functions' source code filenames, line numbers and function names are listed. If the function couldn’t find the debug information, then an array with a single element equal to the name of the binary is returned, otherwise an empty array is returned if the address is not valid. [Array(String)](../data-types/array.md).
**Example**
@@ -232,14 +225,12 @@ addressToSymbol(address_of_binary_instruction)
**Arguments**
-- `address_of_binary_instruction` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Address of instruction in a running process.
+- `address_of_binary_instruction` ([UInt64](../data-types/int-uint.md)) — Address of instruction in a running process.
**Returned value**
-- Symbol from ClickHouse object files.
-- Empty string, if the address is not valid.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Symbol from ClickHouse object files. [String](../data-types/string.md).
+- Empty string, if the address is not valid. [String](../data-types/string.md).
**Example**
@@ -329,14 +320,11 @@ demangle(symbol)
**Arguments**
-- `symbol` ([String](../../sql-reference/data-types/string.md)) — Symbol from an object file.
+- `symbol` ([String](../data-types/string.md)) — Symbol from an object file.
**Returned value**
-- Name of the C++ function.
-- Empty string if a symbol is not valid.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Name of the C++ function, or an empty string if the symbol is not valid. [String](../data-types/string.md).
**Example**
@@ -425,7 +413,7 @@ tid()
**Returned value**
-- Current thread id. [Uint64](../../sql-reference/data-types/int-uint.md#uint-ranges).
+- Current thread id. [Uint64](../data-types/int-uint.md#uint-ranges).
**Example**
@@ -455,7 +443,7 @@ logTrace('message')
**Arguments**
-- `message` — Message that is emitted to server log. [String](../../sql-reference/data-types/string.md#string).
+- `message` — Message that is emitted to server log. [String](../data-types/string.md#string).
**Returned value**
diff --git a/docs/en/sql-reference/functions/ip-address-functions.md b/docs/en/sql-reference/functions/ip-address-functions.md
index be20e02d77e..5b6a3aef2c8 100644
--- a/docs/en/sql-reference/functions/ip-address-functions.md
+++ b/docs/en/sql-reference/functions/ip-address-functions.md
@@ -147,13 +147,11 @@ IPv6StringToNum(string)
**Argument**
-- `string` — IP address. [String](../../sql-reference/data-types/string.md).
+- `string` — IP address. [String](../data-types/string.md).
**Returned value**
-- IPv6 address in binary format.
-
-Type: [FixedString(16)](../../sql-reference/data-types/fixedstring.md).
+- IPv6 address in binary format. [FixedString(16)](../data-types/fixedstring.md).
**Example**
@@ -248,7 +246,7 @@ SELECT IPv6CIDRToRange(toIPv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32);
## toIPv4(string)
-An alias to `IPv4StringToNum()` that takes a string form of IPv4 address and returns value of [IPv4](../../sql-reference/data-types/ipv4.md) type, which is binary equal to value returned by `IPv4StringToNum()`.
+An alias to `IPv4StringToNum()` that takes a string form of IPv4 address and returns value of [IPv4](../data-types/ipv4.md) type, which is binary equal to value returned by `IPv4StringToNum()`.
``` sql
WITH
@@ -296,7 +294,7 @@ Same as `toIPv6`, but if the IPv6 address has an invalid format, it returns null
## toIPv6
-Converts a string form of IPv6 address to [IPv6](../../sql-reference/data-types/ipv6.md) type. If the IPv6 address has an invalid format, returns an empty value.
+Converts a string form of IPv6 address to [IPv6](../data-types/ipv6.md) type. If the IPv6 address has an invalid format, returns an empty value.
Similar to [IPv6StringToNum](#ipv6stringtonums) function, which converts IPv6 address to binary format.
If the input string contains a valid IPv4 address, then the IPv6 equivalent of the IPv4 address is returned.
@@ -309,13 +307,11 @@ toIPv6(string)
**Argument**
-- `string` — IP address. [String](../../sql-reference/data-types/string.md)
+- `string` — IP address. [String](../data-types/string.md)
**Returned value**
-- IP address.
-
-Type: [IPv6](../../sql-reference/data-types/ipv6.md).
+- IP address. [IPv6](../data-types/ipv6.md).
**Examples**
@@ -370,13 +366,11 @@ isIPv4String(string)
**Arguments**
-- `string` — IP address. [String](../../sql-reference/data-types/string.md).
+- `string` — IP address. [String](../data-types/string.md).
**Returned value**
-- `1` if `string` is IPv4 address, `0` otherwise.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- `1` if `string` is IPv4 address, `0` otherwise. [UInt8](../data-types/int-uint.md).
**Examples**
@@ -408,13 +402,11 @@ isIPv6String(string)
**Arguments**
-- `string` — IP address. [String](../../sql-reference/data-types/string.md).
+- `string` — IP address. [String](../data-types/string.md).
**Returned value**
-- `1` if `string` is IPv6 address, `0` otherwise.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- `1` if `string` is IPv6 address, `0` otherwise. [UInt8](../data-types/int-uint.md).
**Examples**
@@ -449,14 +441,12 @@ This function accepts both IPv4 and IPv6 addresses (and networks) represented as
**Arguments**
-- `address` — An IPv4 or IPv6 address. [String](../../sql-reference/data-types/string.md).
-- `prefix` — An IPv4 or IPv6 network prefix in CIDR. [String](../../sql-reference/data-types/string.md).
+- `address` — An IPv4 or IPv6 address. [String](../data-types/string.md).
+- `prefix` — An IPv4 or IPv6 network prefix in CIDR. [String](../data-types/string.md).
**Returned value**
-- `1` or `0`.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- `1` or `0`. [UInt8](../data-types/int-uint.md).
**Example**
diff --git a/docs/en/sql-reference/functions/json-functions.md b/docs/en/sql-reference/functions/json-functions.md
index e920ab82988..8359d5f9fbc 100644
--- a/docs/en/sql-reference/functions/json-functions.md
+++ b/docs/en/sql-reference/functions/json-functions.md
@@ -31,7 +31,7 @@ simpleJSONHas(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
@@ -71,7 +71,7 @@ simpleJSONExtractUInt(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
@@ -118,7 +118,7 @@ simpleJSONExtractInt(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
@@ -165,7 +165,7 @@ simpleJSONExtractFloat(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
@@ -212,7 +212,7 @@ simpleJSONExtractBool(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
@@ -259,12 +259,12 @@ simpleJSONExtractRaw(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
-It returns the value of the field as a [`String`](../../sql-reference/data-types/string.md#string), including separators if the field exists, or an empty `String` otherwise.
+It returns the value of the field as a [`String`](../data-types/string.md#string), including separators if the field exists, or an empty `String` otherwise.
**Example**
@@ -306,12 +306,12 @@ simpleJSONExtractString(json, field_name)
**Parameters**
-- `json`: The JSON in which the field is searched for. [String](../../sql-reference/data-types/string.md#string)
+- `json`: The JSON in which the field is searched for. [String](../data-types/string.md#string)
- `field_name`: The name of the field to search for. [String literal](../syntax#string)
**Returned value**
-It returns the value of a field as a [`String`](../../sql-reference/data-types/string.md#string), including separators. The value is unescaped. It returns an empty `String`: if the field doesn't contain a double quoted string, if unescaping fails or if the field doesn't exist.
+It returns the value of a field as a [`String`](../data-types/string.md#string), including separators. The value is unescaped. It returns an empty `String`: if the field doesn't contain a double quoted string, if unescaping fails or if the field doesn't exist.
**Implementation details**
@@ -386,7 +386,7 @@ SELECT isValidJSON('{"a": "hello", "b": [-100, 200.0, 300]}') = 1
SELECT isValidJSON('not a json') = 0
```
-## JSONHas(json\[, indices_or_keys\]…)
+## JSONHas(json\[, indices_or_keys\]...)
If the value exists in the JSON document, `1` will be returned.
@@ -419,7 +419,7 @@ SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -2) = 'a'
SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'hello'
```
-## JSONLength(json\[, indices_or_keys\]…)
+## JSONLength(json\[, indices_or_keys\]...)
Return the length of a JSON array or a JSON object.
@@ -432,7 +432,7 @@ SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 3
SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}') = 2
```
-## JSONType(json\[, indices_or_keys\]…)
+## JSONType(json\[, indices_or_keys\]...)
Return the type of a JSON value.
@@ -446,13 +446,13 @@ SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'String'
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 'Array'
```
-## JSONExtractUInt(json\[, indices_or_keys\]…)
+## JSONExtractUInt(json\[, indices_or_keys\]...)
-## JSONExtractInt(json\[, indices_or_keys\]…)
+## JSONExtractInt(json\[, indices_or_keys\]...)
-## JSONExtractFloat(json\[, indices_or_keys\]…)
+## JSONExtractFloat(json\[, indices_or_keys\]...)
-## JSONExtractBool(json\[, indices_or_keys\]…)
+## JSONExtractBool(json\[, indices_or_keys\]...)
Parses a JSON and extract a value. These functions are similar to `visitParam` functions.
@@ -466,7 +466,7 @@ SELECT JSONExtractFloat('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 2) = 200
SELECT JSONExtractUInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', -1) = 300
```
-## JSONExtractString(json\[, indices_or_keys\]…)
+## JSONExtractString(json\[, indices_or_keys\]...)
Parses a JSON and extract a string. This function is similar to `visitParamExtractString` functions.
@@ -484,7 +484,7 @@ SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = ''
SELECT JSONExtractString('{"abc":"hello}', 'abc') = ''
```
-## JSONExtract(json\[, indices_or_keys…\], Return_type)
+## JSONExtract(json\[, indices_or_keys...\], Return_type)
Parses a JSON and extract a value of the given ClickHouse data type.
@@ -506,7 +506,7 @@ SELECT JSONExtract('{"day": "Thursday"}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday
SELECT JSONExtract('{"day": 5}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday\' = 1, \'Tuesday\' = 2, \'Wednesday\' = 3, \'Thursday\' = 4, \'Friday\' = 5, \'Saturday\' = 6)') = 'Friday'
```
-## JSONExtractKeysAndValues(json\[, indices_or_keys…\], Value_type)
+## JSONExtractKeysAndValues(json\[, indices_or_keys...\], Value_type)
Parses key-value pairs from a JSON where the values are of the given ClickHouse data type.
@@ -528,14 +528,12 @@ JSONExtractKeys(json[, a, b, c...])
**Arguments**
-- `json` — [String](../../sql-reference/data-types/string.md) with valid JSON.
-- `a, b, c...` — Comma-separated indices or keys that specify the path to the inner field in a nested JSON object. Each argument can be either a [String](../../sql-reference/data-types/string.md) to get the field by the key or an [Integer](../../sql-reference/data-types/int-uint.md) to get the N-th field (indexed from 1, negative integers count from the end). If not set, the whole JSON is parsed as the top-level object. Optional parameter.
+- `json` — [String](../data-types/string.md) with valid JSON.
+- `a, b, c...` — Comma-separated indices or keys that specify the path to the inner field in a nested JSON object. Each argument can be either a [String](../data-types/string.md) to get the field by the key or an [Integer](../data-types/int-uint.md) to get the N-th field (indexed from 1, negative integers count from the end). If not set, the whole JSON is parsed as the top-level object. Optional parameter.
**Returned value**
-Array with the keys of the JSON.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+Array with the keys of the JSON. [Array](../data-types/array.md)([String](../data-types/string.md)).
**Example**
@@ -554,7 +552,7 @@ text
└────────────────────────────────────────────────────────────┘
```
-## JSONExtractRaw(json\[, indices_or_keys\]…)
+## JSONExtractRaw(json\[, indices_or_keys\]...)
Returns a part of JSON as unparsed string.
@@ -566,7 +564,7 @@ Example:
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]';
```
-## JSONExtractArrayRaw(json\[, indices_or_keys…\])
+## JSONExtractArrayRaw(json\[, indices_or_keys...\])
Returns an array with elements of JSON array, each represented as unparsed string.
@@ -590,15 +588,13 @@ JSONExtractKeysAndValuesRaw(json[, p, a, t, h])
**Arguments**
-- `json` — [String](../../sql-reference/data-types/string.md) with valid JSON.
-- `p, a, t, h` — Comma-separated indices or keys that specify the path to the inner field in a nested JSON object. Each argument can be either a [string](../../sql-reference/data-types/string.md) to get the field by the key or an [integer](../../sql-reference/data-types/int-uint.md) to get the N-th field (indexed from 1, negative integers count from the end). If not set, the whole JSON is parsed as the top-level object. Optional parameter.
+- `json` — [String](../data-types/string.md) with valid JSON.
+- `p, a, t, h` — Comma-separated indices or keys that specify the path to the inner field in a nested JSON object. Each argument can be either a [string](../data-types/string.md) to get the field by the key or an [integer](../data-types/int-uint.md) to get the N-th field (indexed from 1, negative integers count from the end). If not set, the whole JSON is parsed as the top-level object. Optional parameter.
**Returned values**
-- Array with `('key', 'value')` tuples. Both tuple members are strings.
-- Empty array if the requested object does not exist, or input JSON is invalid.
-
-Type: [Array](../../sql-reference/data-types/array.md)([Tuple](../../sql-reference/data-types/tuple.md)([String](../../sql-reference/data-types/string.md), [String](../../sql-reference/data-types/string.md)).
+- Array with `('key', 'value')` tuples. Both tuple members are strings. [Array](../data-types/array.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md), [String](../data-types/string.md)).
+- Empty array if the requested object does not exist, or input JSON is invalid. [Array](../data-types/array.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md), [String](../data-types/string.md)).
**Examples**
@@ -723,9 +719,9 @@ Before version 21.11 the order of arguments was wrong, i.e. JSON_VALUE(path, jso
## toJSONString
Serializes a value to its JSON representation. Various data types and nested structures are supported.
-64-bit [integers](../../sql-reference/data-types/int-uint.md) or bigger (like `UInt64` or `Int128`) are enclosed in quotes by default. [output_format_json_quote_64bit_integers](../../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) controls this behavior.
+64-bit [integers](../data-types/int-uint.md) or bigger (like `UInt64` or `Int128`) are enclosed in quotes by default. [output_format_json_quote_64bit_integers](../../operations/settings/settings.md#session_settings-output_format_json_quote_64bit_integers) controls this behavior.
Special values `NaN` and `inf` are replaced with `null`. Enable [output_format_json_quote_denormals](../../operations/settings/settings.md#settings-output_format_json_quote_denormals) setting to show them.
-When serializing an [Enum](../../sql-reference/data-types/enum.md) value, the function outputs its name.
+When serializing an [Enum](../data-types/enum.md) value, the function outputs its name.
**Syntax**
@@ -739,14 +735,12 @@ toJSONString(value)
**Returned value**
-- JSON representation of the value.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- JSON representation of the value. [String](../data-types/string.md).
**Example**
-The first example shows serialization of a [Map](../../sql-reference/data-types/map.md).
-The second example shows some special values wrapped into a [Tuple](../../sql-reference/data-types/tuple.md).
+The first example shows serialization of a [Map](../data-types/map.md).
+The second example shows some special values wrapped into a [Tuple](../data-types/tuple.md).
Query:
@@ -782,13 +776,11 @@ Alias: `JSON_ARRAY_LENGTH(json)`.
**Arguments**
-- `json` — [String](../../sql-reference/data-types/string.md) with valid JSON.
+- `json` — [String](../data-types/string.md) with valid JSON.
**Returned value**
-- If `json` is a valid JSON array string, returns the number of array elements, otherwise returns NULL.
-
-Type: [Nullable(UInt64)](../../sql-reference/data-types/int-uint.md).
+- If `json` is a valid JSON array string, returns the number of array elements, otherwise returns NULL. [Nullable(UInt64)](../data-types/int-uint.md).
**Example**
@@ -815,13 +807,11 @@ jsonMergePatch(json1, json2, ...)
**Arguments**
-- `json` — [String](../../sql-reference/data-types/string.md) with valid JSON.
+- `json` — [String](../data-types/string.md) with valid JSON.
**Returned value**
-- If JSON object strings are valid, return the merged JSON object string.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- If JSON object strings are valid, return the merged JSON object string. [String](../data-types/string.md).
**Example**
diff --git a/docs/en/sql-reference/functions/logical-functions.md b/docs/en/sql-reference/functions/logical-functions.md
index 138b804a575..7222dbeeb0d 100644
--- a/docs/en/sql-reference/functions/logical-functions.md
+++ b/docs/en/sql-reference/functions/logical-functions.md
@@ -6,7 +6,7 @@ sidebar_label: Logical
# Logical Functions
-Below functions perform logical operations on arguments of arbitrary numeric types. They return either 0 or 1 as [UInt8](../../sql-reference/data-types/int-uint.md) or in some cases `NULL`.
+Below functions perform logical operations on arguments of arbitrary numeric types. They return either 0 or 1 as [UInt8](../data-types/int-uint.md) or in some cases `NULL`.
Zero as an argument is considered `false`, non-zero values are considered `true`.
@@ -26,7 +26,7 @@ Alias: The [AND operator](../../sql-reference/operators/index.md#logical-and-ope
**Arguments**
-- `val1, val2, ...` — List of at least two values. [Int](../../sql-reference/data-types/int-uint.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Nullable](../../sql-reference/data-types/nullable.md).
+- `val1, val2, ...` — List of at least two values. [Int](../data-types/int-uint.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Nullable](../data-types/nullable.md).
**Returned value**
@@ -80,7 +80,7 @@ Alias: The [OR operator](../../sql-reference/operators/index.md#logical-or-opera
**Arguments**
-- `val1, val2, ...` — List of at least two values. [Int](../../sql-reference/data-types/int-uint.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Nullable](../../sql-reference/data-types/nullable.md).
+- `val1, val2, ...` — List of at least two values. [Int](../data-types/int-uint.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Nullable](../data-types/nullable.md).
**Returned value**
@@ -132,7 +132,7 @@ Alias: The [Negation operator](../../sql-reference/operators/index.md#logical-ne
**Arguments**
-- `val` — The value. [Int](../../sql-reference/data-types/int-uint.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Nullable](../../sql-reference/data-types/nullable.md).
+- `val` — The value. [Int](../data-types/int-uint.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Nullable](../data-types/nullable.md).
**Returned value**
@@ -168,7 +168,7 @@ xor(val1, val2...)
**Arguments**
-- `val1, val2, ...` — List of at least two values. [Int](../../sql-reference/data-types/int-uint.md), [UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Nullable](../../sql-reference/data-types/nullable.md).
+- `val1, val2, ...` — List of at least two values. [Int](../data-types/int-uint.md), [UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Nullable](../data-types/nullable.md).
**Returned value**
diff --git a/docs/en/sql-reference/functions/math-functions.md b/docs/en/sql-reference/functions/math-functions.md
index 945166056af..7f50fa933b6 100644
--- a/docs/en/sql-reference/functions/math-functions.md
+++ b/docs/en/sql-reference/functions/math-functions.md
@@ -18,7 +18,7 @@ e()
**Returned value**
-Type: [Float64](../../sql-reference/data-types/float.md).
+Type: [Float64](../data-types/float.md).
## pi
@@ -31,7 +31,7 @@ pi()
```
**Returned value**
-Type: [Float64](../../sql-reference/data-types/float.md).
+Type: [Float64](../data-types/float.md).
## exp
@@ -45,11 +45,11 @@ exp(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## log
@@ -65,11 +65,11 @@ Alias: `ln(x)`
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## exp2
@@ -83,11 +83,11 @@ exp2(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## intExp2
@@ -111,11 +111,11 @@ log2(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## exp10
@@ -129,11 +129,11 @@ exp10(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## intExp10
@@ -157,11 +157,11 @@ log10(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## sqrt
@@ -173,11 +173,11 @@ sqrt(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## cbrt
@@ -189,11 +189,11 @@ cbrt(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## erf
@@ -207,11 +207,11 @@ erf(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
**Example**
@@ -239,11 +239,11 @@ erfc(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## lgamma
@@ -257,11 +257,11 @@ lgamma(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## tgamma
@@ -275,11 +275,11 @@ gamma(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## sin
@@ -293,11 +293,11 @@ sin(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
**Example**
@@ -323,11 +323,11 @@ cos(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## tan
@@ -341,11 +341,11 @@ tan(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## asin
@@ -359,11 +359,11 @@ asin(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## acos
@@ -377,11 +377,11 @@ acos(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## atan
@@ -395,11 +395,11 @@ atan(x)
**Arguments**
-- `x` - [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` - [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-Type: [Float*](../../sql-reference/data-types/float.md).
+Type: [Float*](../data-types/float.md).
## pow
@@ -415,12 +415,12 @@ Alias: `power(x, y)`
**Arguments**
-- `x` - [(U)Int8/16/32/64](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md)
-- `y` - [(U)Int8/16/32/64](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md)
+- `x` - [(U)Int8/16/32/64](../data-types/int-uint.md) or [Float*](../data-types/float.md)
+- `y` - [(U)Int8/16/32/64](../data-types/int-uint.md) or [Float*](../data-types/float.md)
**Returned value**
-Type: [Float64](../../sql-reference/data-types/float.md).
+Type: [Float64](../data-types/float.md).
## cosh
@@ -434,13 +434,13 @@ cosh(x)
**Arguments**
-- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- Values from the interval: `1 <= cosh(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -468,13 +468,13 @@ acosh(x)
**Arguments**
-- `x` — Hyperbolic cosine of angle. Values from the interval: `1 <= x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Hyperbolic cosine of angle. Values from the interval: `1 <= x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- The angle, in radians. Values from the interval: `0 <= acosh(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -502,13 +502,13 @@ sinh(x)
**Arguments**
-- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- Values from the interval: `-∞ < sinh(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -536,13 +536,13 @@ asinh(x)
**Arguments**
-- `x` — Hyperbolic sine of angle. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Hyperbolic sine of angle. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- The angle, in radians. Values from the interval: `-∞ < asinh(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -569,13 +569,13 @@ tanh(x)
**Arguments**
-- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — The angle, in radians. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- Values from the interval: `-1 < tanh(x) < 1`.
-Type: [Float*](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float*](../data-types/float.md#float32-float64).
**Example**
@@ -601,13 +601,13 @@ atanh(x)
**Arguments**
-- `x` — Hyperbolic tangent of angle. Values from the interval: `–1 < x < 1`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Hyperbolic tangent of angle. Values from the interval: `–1 < x < 1`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- The angle, in radians. Values from the interval: `-∞ < atanh(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -635,14 +635,14 @@ atan2(y, x)
**Arguments**
-- `y` — y-coordinate of the point through which the ray passes. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md).
-- `x` — x-coordinate of the point through which the ray passes. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md).
+- `y` — y-coordinate of the point through which the ray passes. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
+- `x` — x-coordinate of the point through which the ray passes. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value**
- The angle `θ` such that `−π < θ ≤ π`, in radians.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -670,14 +670,14 @@ hypot(x, y)
**Arguments**
-- `x` — The first cathetus of a right-angle triangle. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md).
-- `y` — The second cathetus of a right-angle triangle. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md).
+- `x` — The first cathetus of a right-angle triangle. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
+- `y` — The second cathetus of a right-angle triangle. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md).
**Returned value**
- The length of the hypotenuse of a right-angle triangle.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -705,13 +705,13 @@ log1p(x)
**Arguments**
-- `x` — Values from the interval: `-1 < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Values from the interval: `-1 < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- Values from the interval: `-∞ < log1p(x) < +∞`.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -747,7 +747,7 @@ sign(x)
- 0 for `x = 0`
- 1 for `x > 0`
-Type: [Int8](../../sql-reference/data-types/int-uint.md).
+Type: [Int8](../data-types/int-uint.md).
**Examples**
@@ -804,11 +804,11 @@ sigmoid(x)
**Parameters**
-- `x` — input value. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — input value. Values from the interval: `-∞ < x < +∞`. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-- Corresponding value along the sigmoid curve between 0 and 1. [Float64](../../sql-reference/data-types/float.md).
+- Corresponding value along the sigmoid curve between 0 and 1. [Float64](../data-types/float.md).
**Example**
@@ -838,13 +838,11 @@ degrees(x)
**Arguments**
-- `x` — Input in radians. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Input in radians. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
-- Value in degrees.
-
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+- Value in degrees. [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -872,13 +870,13 @@ radians(x)
**Arguments**
-- `x` — Input in degrees. [(U)Int*](../../sql-reference/data-types/int-uint.md), [Float*](../../sql-reference/data-types/float.md) or [Decimal*](../../sql-reference/data-types/decimal.md).
+- `x` — Input in degrees. [(U)Int*](../data-types/int-uint.md), [Float*](../data-types/float.md) or [Decimal*](../data-types/decimal.md).
**Returned value**
- Value in radians.
-Type: [Float64](../../sql-reference/data-types/float.md#float32-float64).
+Type: [Float64](../data-types/float.md#float32-float64).
**Example**
@@ -947,3 +945,49 @@ Result:
│ 11 │
└──────────────────────────────────┘
```
+
+## proportionsZTest
+
+Returns test statistics for the two proportion Z-test - a statistical test for comparing the proportions from two populations `x` and `y`.
+
+**Syntax**
+
+```sql
+proportionsZTest(successes_x, successes_y, trials_x, trials_y, conf_level, pool_type)
+```
+
+**Arguments**
+
+- `successes_x`: Number of successes in population `x`. [UInt64](../data-types/int-uint.md).
+- `successes_y`: Number of successes in population `y`. [UInt64](../data-types/int-uint.md).
+- `trials_x`: Number of trials in population `x`. [UInt64](../data-types/int-uint.md).
+- `trials_y`: Number of trials in population `y`. [UInt64](../data-types/int-uint.md).
+- `conf_level`: Confidence level for the test. [Float64](../data-types/float.md).
+- `pool_type`: Selection of pooling (way in which the standard error is estimated). Can be either `unpooled` or `pooled`. [String](../data-types/string.md).
+
+:::note
+For argument `pool_type`: In the pooled version, the two proportions are averaged, and only one proportion is used to estimate the standard error. In the unpooled version, the two proportions are used separately.
+:::
+
+**Returned value**
+
+- `z_stat`: Z statistic. [Float64](../data-types/float.md).
+- `p_val`: P value. [Float64](../data-types/float.md).
+- `ci_low`: The lower confidence interval. [Float64](../data-types/float.md).
+- `ci_high`: The upper confidence interval. [Float64](../data-types/float.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT proportionsZTest(10, 11, 100, 101, 0.95, 'unpooled');
+```
+
+Result:
+
+```response
+┌─proportionsZTest(10, 11, 100, 101, 0.95, 'unpooled')───────────────────────────────┐
+│ (-0.20656724435948853,0.8363478437079654,-0.09345975390115283,0.07563797172293502) │
+└────────────────────────────────────────────────────────────────────────────────────┘
+```
\ No newline at end of file
diff --git a/docs/en/sql-reference/functions/nlp-functions.md b/docs/en/sql-reference/functions/nlp-functions.md
index 3e0458d226d..4bfa181a35f 100644
--- a/docs/en/sql-reference/functions/nlp-functions.md
+++ b/docs/en/sql-reference/functions/nlp-functions.md
@@ -23,7 +23,7 @@ stem('language', word)
### Arguments
- `language` — Language which rules will be applied. Use the two letter [ISO 639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
-- `word` — word that needs to be stemmed. Must be in lowercase. [String](../../sql-reference/data-types/string.md#string).
+- `word` — word that needs to be stemmed. Must be in lowercase. [String](../data-types/string.md#string).
### Examples
@@ -88,8 +88,8 @@ lemmatize('language', word)
### Arguments
-- `language` — Language which rules will be applied. [String](../../sql-reference/data-types/string.md#string).
-- `word` — Word that needs to be lemmatized. Must be lowercase. [String](../../sql-reference/data-types/string.md#string).
+- `language` — Language which rules will be applied. [String](../data-types/string.md#string).
+- `word` — Word that needs to be lemmatized. Must be lowercase. [String](../data-types/string.md#string).
### Examples
@@ -139,8 +139,8 @@ synonyms('extension_name', word)
### Arguments
-- `extension_name` — Name of the extension in which search will be performed. [String](../../sql-reference/data-types/string.md#string).
-- `word` — Word that will be searched in extension. [String](../../sql-reference/data-types/string.md#string).
+- `extension_name` — Name of the extension in which search will be performed. [String](../data-types/string.md#string).
+- `word` — Word that will be searched in extension. [String](../data-types/string.md#string).
### Examples
@@ -188,7 +188,7 @@ detectLanguage('text_to_be_analyzed')
### Arguments
-- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../../sql-reference/data-types/string.md#string).
+- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../data-types/string.md#string).
### Returned value
@@ -226,7 +226,7 @@ detectLanguageMixed('text_to_be_analyzed')
### Arguments
-- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../../sql-reference/data-types/string.md#string).
+- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../data-types/string.md#string).
### Returned value
@@ -262,7 +262,7 @@ detectLanguageUnknown('text_to_be_analyzed')
### Arguments
-- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../../sql-reference/data-types/string.md#string).
+- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../data-types/string.md#string).
### Returned value
@@ -302,7 +302,7 @@ detectCharset('text_to_be_analyzed')
### Arguments
-- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../../sql-reference/data-types/string.md#string).
+- `text_to_be_analyzed` — A collection (or sentences) of strings to analyze. [String](../data-types/string.md#string).
### Returned value
diff --git a/docs/en/sql-reference/functions/other-functions.md b/docs/en/sql-reference/functions/other-functions.md
index 12b565d5358..dfe1224f7b8 100644
--- a/docs/en/sql-reference/functions/other-functions.md
+++ b/docs/en/sql-reference/functions/other-functions.md
@@ -6,11 +6,21 @@ sidebar_label: Other
# Other Functions
-## hostName()
+## hostName
Returns the name of the host on which this function was executed. If the function executes on a remote server (distributed processing), the remote server name is returned.
If the function executes in the context of a distributed table, it generates a normal column with values relevant to each shard. Otherwise it produces a constant value.
+**Syntax**
+
+```sql
+hostName()
+```
+
+**Returned value**
+
+- Host name. [String](../data-types/string.md).
+
## getMacro {#getMacro}
Returns a named value from the [macros](../../operations/server-configuration-parameters/settings.md#macros) section of the server configuration.
@@ -23,13 +33,11 @@ getMacro(name);
**Arguments**
-- `name` — Macro name to retrieve from the `` section. [String](../../sql-reference/data-types/string.md#string).
+- `name` — Macro name to retrieve from the `` section. [String](../data-types/string.md#string).
**Returned value**
-- Value of the specified macro.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Value of the specified macro. [String](../data-types/string.md).
**Example**
@@ -82,9 +90,7 @@ This function is case-insensitive.
**Returned value**
-- String with the fully qualified domain name.
-
-Type: `String`.
+- String with the fully qualified domain name. [String](../data-types/string.md).
**Example**
@@ -110,7 +116,7 @@ basename(expr)
**Arguments**
-- `expr` — A value of type [String](../../sql-reference/data-types/string.md). Backslashes must be escaped.
+- `expr` — A value of type [String](../data-types/string.md). Backslashes must be escaped.
**Returned Value**
@@ -163,34 +169,58 @@ Result:
└────────────────┴────────────────────────────┘
```
-## visibleWidth(x)
+## visibleWidth
Calculates the approximate width when outputting values to the console in text format (tab-separated).
-This function is used by the system to implement Pretty formats.
+This function is used by the system to implement [Pretty formats](../../interfaces/formats.md).
`NULL` is represented as a string corresponding to `NULL` in `Pretty` formats.
+**Syntax**
+
+```sql
+visibleWidth(x)
+```
+
+**Example**
+
+Query:
+
```sql
SELECT visibleWidth(NULL)
```
+Result:
+
```text
┌─visibleWidth(NULL)─┐
│ 4 │
└────────────────────┘
```
-## toTypeName(x)
+## toTypeName
Returns the type name of the passed argument.
If `NULL` is passed, then the function returns type `Nullable(Nothing)`, which corresponds to ClickHouse's internal `NULL` representation.
-## blockSize() {#blockSize}
+**Syntax**
+
+```sql
+toTypeName(x)
+```
+
+## blockSize {#blockSize}
In ClickHouse, queries are processed in blocks (chunks).
This function returns the size (row count) of the block the function is called on.
+**Syntax**
+
+```sql
+blockSize()
+```
+
## byteSize
Returns an estimation of uncompressed byte size of its arguments in memory.
@@ -207,13 +237,11 @@ byteSize(argument [, ...])
**Returned value**
-- Estimation of byte size of the arguments in memory.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- Estimation of byte size of the arguments in memory. [UInt64](../data-types/int-uint.md).
**Examples**
-For [String](../../sql-reference/data-types/string.md) arguments, the function returns the string length + 9 (terminating zero + length).
+For [String](../data-types/string.md) arguments, the function returns the string length + 9 (terminating zero + length).
Query:
@@ -288,16 +316,28 @@ Result:
└────────────────────────────┘
```
-## materialize(x)
+## materialize
Turns a constant into a full column containing a single value.
Full columns and constants are represented differently in memory. Functions usually execute different code for normal and constant arguments, although the result should typically be the same. This function can be used to debug this behavior.
-## ignore(…)
+**Syntax**
+
+```sql
+materialize(x)
+```
+
+## ignore
Accepts any arguments, including `NULL` and does nothing. Always returns 0.
The argument is internally still evaluated. Useful e.g. for benchmarks.
+**Syntax**
+
+```sql
+ignore(x)
+```
+
## sleep
Used to introduce a delay or pause in the execution of a query. It is primarily used for testing and debugging purposes.
@@ -310,7 +350,7 @@ sleep(seconds)
**Arguments**
-- `seconds`: [UInt*](../../sql-reference/data-types/int-uint.md) or [Float](../../sql-reference/data-types/float.md) The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
+- `seconds`: [UInt*](../data-types/int-uint.md) or [Float](../data-types/float.md) The number of seconds to pause the query execution to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
**Returned value**
@@ -360,7 +400,7 @@ sleepEachRow(seconds)
**Arguments**
-- `seconds`: [UInt*](../../sql-reference/data-types/int-uint.md) or [Float*](../../sql-reference/data-types/float.md) The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
+- `seconds`: [UInt*](../data-types/int-uint.md) or [Float*](../data-types/float.md) The number of seconds to pause the query execution for each row in the result set to a maximum of 3 seconds. It can be a floating-point value to specify fractional seconds.
**Returned value**
@@ -392,27 +432,33 @@ The `sleepEachRow()` function is primarily used for testing and debugging purpos
Like the [`sleep()` function](#sleep), it's important to use `sleepEachRow()` judiciously and only when necessary, as it can significantly impact the overall performance and responsiveness of your ClickHouse system, especially when dealing with large result sets.
-## currentDatabase()
+## currentDatabase
Returns the name of the current database.
Useful in table engine parameters of `CREATE TABLE` queries where you need to specify the database.
-## currentUser() {#currentUser}
+**Syntax**
+
+```sql
+currentDatabase()
+```
+
+## currentUser {#currentUser}
Returns the name of the current user. In case of a distributed query, the name of the user who initiated the query is returned.
+**Syntax**
+
```sql
-SELECT currentUser();
+currentUser()
```
Aliases: `user()`, `USER()`, `current_user()`. Aliases are case insensitive.
**Returned values**
-- The name of the current user.
-- In distributed queries, the login of the user who initiated the query.
-
-Type: `String`.
+- The name of the current user. [String](../data-types/string.md).
+- In distributed queries, the login of the user who initiated the query. [String](../data-types/string.md).
**Example**
@@ -448,10 +494,8 @@ isConstant(x)
**Returned values**
-- `1` if `x` is constant.
-- `0` if `x` is non-constant.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- `1` if `x` is constant. [UInt8](../data-types/int-uint.md).
+- `0` if `x` is non-constant. [UInt8](../data-types/int-uint.md).
**Examples**
@@ -497,52 +541,6 @@ Result:
└────────────────────┘
```
-## isFinite(x)
-
-Returns 1 if the Float32 or Float64 argument not infinite and not a NaN, otherwise this function returns 0.
-
-## isInfinite(x)
-
-Returns 1 if the Float32 or Float64 argument is infinite, otherwise this function returns 0. Note that 0 is returned for a NaN.
-
-## ifNotFinite
-
-Checks whether a floating point value is finite.
-
-**Syntax**
-
-```sql
-ifNotFinite(x,y)
-```
-
-**Arguments**
-
-- `x` — Value to check for infinity. Type: [Float\*](../../sql-reference/data-types/float.md).
-- `y` — Fallback value. Type: [Float\*](../../sql-reference/data-types/float.md).
-
-**Returned value**
-
-- `x` if `x` is finite.
-- `y` if `x` is not finite.
-
-**Example**
-
-Query:
-
- SELECT 1/0 as infimum, ifNotFinite(infimum,42)
-
-Result:
-
- ┌─infimum─┬─ifNotFinite(divide(1, 0), 42)─┐
- │ inf │ 42 │
- └─────────┴───────────────────────────────┘
-
-You can get similar result by using the [ternary operator](../../sql-reference/functions/conditional-functions.md#ternary-operator): `isFinite(x) ? x : y`.
-
-## isNaN(x)
-
-Returns 1 if the Float32 and Float64 argument is NaN, otherwise this function 0.
-
## hasColumnInTable
Given the database name, the table name, and the column name as constant strings, returns 1 if the given column exists, otherwise 0.
@@ -733,11 +731,19 @@ LIMIT 10
└────────────────┴─────────┘
```
-## formatReadableDecimalSize(x)
+## formatReadableDecimalSize
Given a size (number of bytes), this function returns a readable, rounded size with suffix (KB, MB, etc.) as string.
-Example:
+**Syntax**
+
+```sql
+formatReadableDecimalSize(x)
+```
+
+**Example**
+
+Query:
```sql
SELECT
@@ -745,6 +751,8 @@ SELECT
formatReadableDecimalSize(filesize_bytes) AS filesize
```
+Result:
+
```text
┌─filesize_bytes─┬─filesize───┐
│ 1 │ 1.00 B │
@@ -754,11 +762,20 @@ SELECT
└────────────────┴────────────┘
```
-## formatReadableSize(x)
+## formatReadableSize
Given a size (number of bytes), this function returns a readable, rounded size with suffix (KiB, MiB, etc.) as string.
-Example:
+**Syntax**
+
+```sql
+formatReadableSize(x)
+```
+Alias: `FORMAT_BYTES`.
+
+**Example**
+
+Query:
```sql
SELECT
@@ -766,7 +783,7 @@ SELECT
formatReadableSize(filesize_bytes) AS filesize
```
-Alias: `FORMAT_BYTES`.
+Result:
```text
┌─filesize_bytes─┬─filesize───┐
@@ -777,11 +794,19 @@ Alias: `FORMAT_BYTES`.
└────────────────┴────────────┘
```
-## formatReadableQuantity(x)
+## formatReadableQuantity
Given a number, this function returns a rounded number with suffix (thousand, million, billion, etc.) as string.
-Example:
+**Syntax**
+
+```sql
+formatReadableQuantity(x)
+```
+
+**Example**
+
+Query:
```sql
SELECT
@@ -789,6 +814,8 @@ SELECT
formatReadableQuantity(number) AS number_for_humans
```
+Result:
+
```text
┌─────────number─┬─number_for_humans─┐
│ 1024 │ 1.02 thousand │
@@ -903,15 +930,27 @@ SELECT parseTimeDelta('1yr2mo')
└──────────────────────────┘
```
-## least(a, b)
+## least
Returns the smaller value of a and b.
-## greatest(a, b)
+**Syntax**
+
+```sql
+least(a, b)
+```
+
+## greatest
Returns the larger value of a and b.
-## uptime()
+**Syntax**
+
+```sql
+greatest(a, b)
+```
+
+## uptime
Returns the server’s uptime in seconds.
If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard. Otherwise it produces a constant value.
@@ -924,9 +963,7 @@ uptime()
**Returned value**
-- Time value of seconds.
-
-Type: [UInt32](/docs/en/sql-reference/data-types/int-uint.md).
+- Time value of seconds. [UInt32](../data-types/int-uint.md).
**Example**
@@ -944,7 +981,7 @@ Result:
└────────┘
```
-## version()
+## version
Returns the current version of ClickHouse as a string in the form of:
@@ -971,7 +1008,7 @@ None.
**Returned value**
-Type: [String](../data-types/string)
+- Current version of ClickHouse. [String](../data-types/string).
**Implementation details**
@@ -993,11 +1030,17 @@ SELECT version()
└───────────┘
```
-## buildId()
+## buildId
Returns the build ID generated by a compiler for the running ClickHouse server binary.
If executed in the context of a distributed table, this function generates a normal column with values relevant to each shard. Otherwise it produces a constant value.
+**Syntax**
+
+```sql
+buildId()
+```
+
## blockNumber
Returns a monotonically increasing sequence number of the [block](../../development/architecture.md#block) containing the row.
@@ -1160,9 +1203,6 @@ Result:
└────────────────────────┘
```
-
-
-
## neighbor
The window function that provides access to a row at a specified offset before or after the current row of a given column.
@@ -1186,7 +1226,7 @@ To prevent that you can create a subquery with [ORDER BY](../../sql-reference/st
**Arguments**
- `column` — A column name or scalar expression.
-- `offset` — The number of rows to look before or ahead of the current row in `column`. [Int64](../../sql-reference/data-types/int-uint.md).
+- `offset` — The number of rows to look before or ahead of the current row in `column`. [Int64](../data-types/int-uint.md).
- `default_value` — Optional. The returned value if offset is beyond the block boundaries. Type of data blocks affected.
**Returned values**
@@ -1194,7 +1234,9 @@ To prevent that you can create a subquery with [ORDER BY](../../sql-reference/st
- Value of `column` with `offset` distance from current row, if `offset` is not outside the block boundaries.
- The default value of `column` or `default_value` (if given), if `offset` is outside the block boundaries.
-Type: type of data blocks affected or default value type.
+:::note
+The return type will be that of the data blocks affected or the default value type.
+:::
**Example**
@@ -1281,7 +1323,7 @@ Result:
└────────────┴───────┴───────────┴────────────────┘
```
-## runningDifference(x) {#runningDifference}
+## runningDifference {#runningDifference}
Calculates the difference between two consecutive row values in the data block.
Returns 0 for the first row, and for subsequent rows the difference to the previous row.
@@ -1296,7 +1338,15 @@ The result of the function depends on the affected data blocks and the order of
The order of rows during calculation of `runningDifference()` can differ from the order of rows returned to the user.
To prevent that you can create a subquery with [ORDER BY](../../sql-reference/statements/select/order-by.md) and call the function from outside the subquery.
-Example:
+**Syntax**
+
+```sql
+runningDifference(x)
+```
+
+**Example**
+
+Query:
```sql
SELECT
@@ -1315,6 +1365,8 @@ FROM
)
```
+Result:
+
```text
┌─EventID─┬───────────EventTime─┬─delta─┐
│ 1106 │ 2016-11-24 00:00:04 │ 0 │
@@ -1327,6 +1379,8 @@ FROM
Please note that the block size affects the result. The internal state of `runningDifference` state is reset for each new block.
+Query:
+
```sql
SELECT
number,
@@ -1335,6 +1389,8 @@ FROM numbers(100000)
WHERE diff != 1
```
+Result:
+
```text
┌─number─┬─diff─┐
│ 0 │ 0 │
@@ -1344,6 +1400,8 @@ WHERE diff != 1
└────────┴──────┘
```
+Query:
+
```sql
set max_block_size=100000 -- default value is 65536!
@@ -1354,6 +1412,8 @@ FROM numbers(100000)
WHERE diff != 1
```
+Result:
+
```text
┌─number─┬─diff─┐
│ 0 │ 0 │
@@ -1386,14 +1446,12 @@ runningConcurrency(start, end)
**Arguments**
-- `start` — A column with the start time of events. [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md), or [DateTime64](../../sql-reference/data-types/datetime64.md).
-- `end` — A column with the end time of events. [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md), or [DateTime64](../../sql-reference/data-types/datetime64.md).
+- `start` — A column with the start time of events. [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), or [DateTime64](../data-types/datetime64.md).
+- `end` — A column with the end time of events. [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), or [DateTime64](../data-types/datetime64.md).
**Returned values**
-- The number of concurrent events at each event start time.
-
-Type: [UInt32](../../sql-reference/data-types/int-uint.md)
+- The number of concurrent events at each event start time. [UInt32](../data-types/int-uint.md)
**Example**
@@ -1425,23 +1483,43 @@ Result:
└────────────┴────────────────────────────────┘
```
-## MACNumToString(num)
+## MACNumToString
Interprets a UInt64 number as a MAC address in big endian format. Returns the corresponding MAC address in format AA:BB:CC:DD:EE:FF (colon-separated numbers in hexadecimal form) as string.
-## MACStringToNum(s)
+**Syntax**
+
+```sql
+MACNumToString(num)
+```
+
+## MACStringToNum
The inverse function of MACNumToString. If the MAC address has an invalid format, it returns 0.
-## MACStringToOUI(s)
+**Syntax**
+
+```sql
+MACStringToNum(s)
+```
+
+## MACStringToOUI
Given a MAC address in format AA:BB:CC:DD:EE:FF (colon-separated numbers in hexadecimal form), returns the first three octets as a UInt64 number. If the MAC address has an invalid format, it returns 0.
+**Syntax**
+
+```sql
+MACStringToOUI(s)
+```
+
## getSizeOfEnumType
-Returns the number of fields in [Enum](../../sql-reference/data-types/enum.md).
+Returns the number of fields in [Enum](../data-types/enum.md).
An exception is thrown if the type is not `Enum`.
+**Syntax**
+
```sql
getSizeOfEnumType(value)
```
@@ -1502,6 +1580,8 @@ Result:
Returns the internal name of the data type that represents the value.
+**Syntax**
+
```sql
toColumnTypeName(value)
```
@@ -1580,6 +1660,8 @@ Returns the default value for the given data type.
Does not include default values for custom columns set by the user.
+**Syntax**
+
```sql
defaultValueOfArgumentType(expression)
```
@@ -1592,7 +1674,7 @@ defaultValueOfArgumentType(expression)
- `0` for numbers.
- Empty string for strings.
-- `ᴺᵁᴸᴸ` for [Nullable](../../sql-reference/data-types/nullable.md).
+- `ᴺᵁᴸᴸ` for [Nullable](../data-types/nullable.md).
**Example**
@@ -1642,7 +1724,7 @@ defaultValueOfTypeName(type)
- `0` for numbers.
- Empty string for strings.
-- `ᴺᵁᴸᴸ` for [Nullable](../../sql-reference/data-types/nullable.md).
+- `ᴺᵁᴸᴸ` for [Nullable](../data-types/nullable.md).
**Example**
@@ -1688,7 +1770,7 @@ SELECT * FROM table WHERE indexHint()
**Returned value**
-Type: [Uint8](https://clickhouse.com/docs/en/data_types/int_uint/#diapazony-uint).
+- `1`. [Uint8](../data-types/int-uint.md).
**Example**
@@ -1778,29 +1860,31 @@ Result:
Creates an array with a single value.
-Used for the internal implementation of [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin).
+:::note
+This function is used for the internal implementation of [arrayJoin](../../sql-reference/functions/array-join.md#functions_arrayjoin).
+:::
+
+**Syntax**
```sql
-SELECT replicate(x, arr);
+replicate(x, arr)
```
-**Arguments:**
+**Arguments**
-- `arr` — An array.
- `x` — The value to fill the result array with.
+- `arr` — An array. [Array](../data-types/array.md).
**Returned value**
-An array of the lame length as `arr` filled with value `x`.
-
-Type: `Array`.
+An array of the lame length as `arr` filled with value `x`. [Array](../data-types/array.md).
**Example**
Query:
```sql
-SELECT replicate(1, ['a', 'b', 'c'])
+SELECT replicate(1, ['a', 'b', 'c']);
```
Result:
@@ -1811,6 +1895,36 @@ Result:
└───────────────────────────────┘
```
+## revision
+
+Returns the current ClickHouse [server revision](../../operations/system-tables/metrics#revision).
+
+**Syntax**
+
+```sql
+revision()
+```
+
+**Returned value**
+
+- The current ClickHouse server revision. [UInt32](../data-types/int-uint.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT revision();
+```
+
+Result:
+
+```response
+┌─revision()─┐
+│ 54485 │
+└────────────┘
+```
+
## filesystemAvailable
Returns the amount of free space in the filesystem hosting the database persistence. The returned value is always smaller than total free space ([filesystemFree](#filesystemfree)) because some space is reserved for the operating system.
@@ -1823,9 +1937,7 @@ filesystemAvailable()
**Returned value**
-- The amount of remaining space available in bytes.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The amount of remaining space available in bytes. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1855,9 +1967,7 @@ filesystemFree()
**Returned value**
-- The amount of free space in bytes.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The amount of free space in bytes. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1887,9 +1997,7 @@ filesystemCapacity()
**Returned value**
-- Capacity of the filesystem in bytes.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- Capacity of the filesystem in bytes. [UInt64](../data-types/int-uint.md).
**Example**
@@ -1909,7 +2017,7 @@ Result:
## initializeAggregation
-Calculates the result of an aggregate function based on a single value. This function can be used to initialize aggregate functions with combinator [-State](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-state). You can create states of aggregate functions and insert them to columns of type [AggregateFunction](../../sql-reference/data-types/aggregatefunction.md#data-type-aggregatefunction) or use initialized aggregates as default values.
+Calculates the result of an aggregate function based on a single value. This function can be used to initialize aggregate functions with combinator [-State](../../sql-reference/aggregate-functions/combinators.md#agg-functions-combinator-state). You can create states of aggregate functions and insert them to columns of type [AggregateFunction](../data-types/aggregatefunction.md#data-type-aggregatefunction) or use initialized aggregates as default values.
**Syntax**
@@ -1919,7 +2027,7 @@ initializeAggregation (aggregate_function, arg1, arg2, ..., argN)
**Arguments**
-- `aggregate_function` — Name of the aggregation function to initialize. [String](../../sql-reference/data-types/string.md).
+- `aggregate_function` — Name of the aggregation function to initialize. [String](../data-types/string.md).
- `arg` — Arguments of aggregate function.
**Returned value(s)**
@@ -1994,13 +2102,15 @@ finalizeAggregation(state)
**Arguments**
-- `state` — State of aggregation. [AggregateFunction](../../sql-reference/data-types/aggregatefunction.md#data-type-aggregatefunction).
+- `state` — State of aggregation. [AggregateFunction](../data-types/aggregatefunction.md#data-type-aggregatefunction).
**Returned value(s)**
- Value/values that was aggregated.
-Type: Value of any types that was aggregated.
+:::note
+The return type is equal to that of any types which were aggregated.
+:::
**Examples**
@@ -2100,8 +2210,8 @@ runningAccumulate(agg_state[, grouping]);
**Arguments**
-- `agg_state` — State of the aggregate function. [AggregateFunction](../../sql-reference/data-types/aggregatefunction.md#data-type-aggregatefunction).
-- `grouping` — Grouping key. Optional. The state of the function is reset if the `grouping` value is changed. It can be any of the [supported data types](../../sql-reference/data-types/index.md) for which the equality operator is defined.
+- `agg_state` — State of the aggregate function. [AggregateFunction](../data-types/aggregatefunction.md#data-type-aggregatefunction).
+- `grouping` — Grouping key. Optional. The state of the function is reset if the `grouping` value is changed. It can be any of the [supported data types](../data-types/index.md) for which the equality operator is defined.
**Returned value**
@@ -2253,7 +2363,7 @@ Result:
└──────────────────────────────────────────────────┘
```
-## catboostEvaluate(path_to_model, feature_1, feature_2, …, feature_n)
+## catboostEvaluate
:::note
This function is not available in ClickHouse Cloud.
@@ -2262,6 +2372,14 @@ This function is not available in ClickHouse Cloud.
Evaluate an external catboost model. [CatBoost](https://catboost.ai) is an open-source gradient boosting library developed by Yandex for machine learning.
Accepts a path to a catboost model and model arguments (features). Returns Float64.
+**Syntax**
+
+```sql
+catboostEvaluate(path_to_model, feature_1, feature_2, ..., feature_n)
+```
+
+**Example**
+
```sql
SELECT feat1, ..., feat_n, catboostEvaluate('/path/to/model.bin', feat_1, ..., feat_n) AS prediction
FROM data_table
@@ -2298,10 +2416,16 @@ communicate using a HTTP interface. By default, port `9012` is used. A different
See [Training and applying models](https://catboost.ai/docs/features/training.html#training) for how to train catboost models from a training data set.
-## throwIf(x\[, message\[, error_code\]\])
+## throwIf
Throw an exception if argument `x` is true.
+**Syntax**
+
+```sql
+throwIf(x[, message[, error_code]])
+```
+
**Arguments**
- `x` - the condition to check.
@@ -2361,7 +2485,7 @@ getSetting('custom_setting');
**Parameter**
-- `custom_setting` — The setting name. [String](../../sql-reference/data-types/string.md).
+- `custom_setting` — The setting name. [String](../data-types/string.md).
**Returned value**
@@ -2386,7 +2510,7 @@ Result:
## isDecimalOverflow
-Checks whether the [Decimal](../../sql-reference/data-types/decimal.md) value is outside its precision or outside the specified precision.
+Checks whether the [Decimal](../data-types/decimal.md) value is outside its precision or outside the specified precision.
**Syntax**
@@ -2396,8 +2520,8 @@ isDecimalOverflow(d, [p])
**Arguments**
-- `d` — value. [Decimal](../../sql-reference/data-types/decimal.md).
-- `p` — precision. Optional. If omitted, the initial precision of the first argument is used. This parameter can be helpful to migrate data from/to another database or file. [UInt8](../../sql-reference/data-types/int-uint.md#uint-ranges).
+- `d` — value. [Decimal](../data-types/decimal.md).
+- `p` — precision. Optional. If omitted, the initial precision of the first argument is used. This parameter can be helpful to migrate data from/to another database or file. [UInt8](../data-types/int-uint.md#uint-ranges).
**Returned values**
@@ -2433,13 +2557,11 @@ countDigits(x)
**Arguments**
-- `x` — [Int](../../sql-reference/data-types/int-uint.md) or [Decimal](../../sql-reference/data-types/decimal.md) value.
+- `x` — [Int](../data-types/int-uint.md) or [Decimal](../data-types/decimal.md) value.
**Returned value**
-Number of digits.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md#uint-ranges).
+- Number of digits. [UInt8](../data-types/int-uint.md#uint-ranges).
:::note
For `Decimal` values takes into account their scales: calculates result over underlying integer type which is `(value * scale)`. For example: `countDigits(42) = 2`, `countDigits(42.000) = 5`, `countDigits(0.04200) = 4`. I.e. you may check decimal overflow for `Decimal64` with `countDecimal(x) > 18`. It's a slow variant of [isDecimalOverflow](#is-decimal-overflow).
@@ -2463,9 +2585,7 @@ Result:
## errorCodeToName
-Returns the textual name of an error code.
-
-Type: [LowCardinality(String)](../../sql-reference/data-types/lowcardinality.md).
+- The textual name of an error code. [LowCardinality(String)](../data-types/lowcardinality.md).
**Syntax**
@@ -2496,9 +2616,7 @@ tcpPort()
**Returned value**
-- The TCP port number.
-
-Type: [UInt16](../../sql-reference/data-types/int-uint.md).
+- The TCP port number. [UInt16](../data-types/int-uint.md).
**Example**
@@ -2534,9 +2652,7 @@ currentProfiles()
**Returned value**
-- List of the current user settings profiles.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- List of the current user settings profiles. [Array](../data-types/array.md)([String](../data-types/string.md)).
## enabledProfiles
@@ -2550,9 +2666,7 @@ enabledProfiles()
**Returned value**
-- List of the enabled settings profiles.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- List of the enabled settings profiles. [Array](../data-types/array.md)([String](../data-types/string.md)).
## defaultProfiles
@@ -2566,9 +2680,7 @@ defaultProfiles()
**Returned value**
-- List of the default settings profiles.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- List of the default settings profiles. [Array](../data-types/array.md)([String](../data-types/string.md)).
## currentRoles
@@ -2582,9 +2694,7 @@ currentRoles()
**Returned value**
-- A list of the current roles for the current user.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- A list of the current roles for the current user. [Array](../data-types/array.md)([String](../data-types/string.md)).
## enabledRoles
@@ -2598,9 +2708,7 @@ enabledRoles()
**Returned value**
-- List of the enabled roles for the current user.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- List of the enabled roles for the current user. [Array](../data-types/array.md)([String](../data-types/string.md)).
## defaultRoles
@@ -2614,9 +2722,7 @@ defaultRoles()
**Returned value**
-- List of the default roles for the current user.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- List of the default roles for the current user. [Array](../data-types/array.md)([String](../data-types/string.md)).
## getServerPort
@@ -2630,7 +2736,7 @@ getServerPort(port_name)
**Arguments**
-- `port_name` — The name of the server port. [String](../../sql-reference/data-types/string.md#string). Possible values:
+- `port_name` — The name of the server port. [String](../data-types/string.md#string). Possible values:
- 'tcp_port'
- 'tcp_port_secure'
@@ -2645,9 +2751,7 @@ getServerPort(port_name)
**Returned value**
-- The number of the server port.
-
-Type: [UInt16](../../sql-reference/data-types/int-uint.md).
+- The number of the server port. [UInt16](../data-types/int-uint.md).
**Example**
@@ -2679,9 +2783,7 @@ queryID()
**Returned value**
-- The ID of the current query.
-
-Type: [String](../../sql-reference/data-types/string.md)
+- The ID of the current query. [String](../data-types/string.md)
**Example**
@@ -2715,9 +2817,7 @@ initialQueryID()
**Returned value**
-- The ID of the initial current query.
-
-Type: [String](../../sql-reference/data-types/string.md)
+- The ID of the initial current query. [String](../data-types/string.md)
**Example**
@@ -2750,9 +2850,7 @@ shardNum()
**Returned value**
-- Shard index or constant `0`.
-
-Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- Shard index or constant `0`. [UInt32](../data-types/int-uint.md).
**Example**
@@ -2792,9 +2890,7 @@ shardCount()
**Returned value**
-- Total number of shards or `0`.
-
-Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- Total number of shards or `0`. [UInt32](../data-types/int-uint.md).
**See Also**
@@ -2816,9 +2912,7 @@ getOSKernelVersion()
**Returned value**
-- The current OS kernel version.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- The current OS kernel version. [String](../data-types/string.md).
**Example**
@@ -2852,9 +2946,7 @@ zookeeperSessionUptime()
**Returned value**
-- Uptime of the current ZooKeeper session in seconds.
-
-Type: [UInt32](../../sql-reference/data-types/int-uint.md).
+- Uptime of the current ZooKeeper session in seconds. [UInt32](../data-types/int-uint.md).
**Example**
@@ -2891,9 +2983,7 @@ All arguments must be constant.
**Returned value**
-- Randomly generated table structure.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Randomly generated table structure. [String](../data-types/string.md).
**Examples**
@@ -2960,9 +3050,7 @@ structureToCapnProtoSchema(structure)
**Returned value**
-- CapnProto schema
-
-Type: [String](../../sql-reference/data-types/string.md).
+- CapnProto schema. [String](../data-types/string.md).
**Examples**
@@ -3061,9 +3149,7 @@ structureToProtobufSchema(structure)
**Returned value**
-- Protobuf schema
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Protobuf schema. [String](../data-types/string.md).
**Examples**
@@ -3143,11 +3229,11 @@ formatQueryOrNull(query)
**Arguments**
-- `query` - The SQL query to be formatted. [String](../../sql-reference/data-types/string.md)
+- `query` - The SQL query to be formatted. [String](../data-types/string.md)
**Returned value**
-- The formatted query. [String](../../sql-reference/data-types/string.md).
+- The formatted query. [String](../data-types/string.md).
**Example**
@@ -3182,11 +3268,11 @@ formatQuerySingleLineOrNull(query)
**Arguments**
-- `query` - The SQL query to be formatted. [String](../../sql-reference/data-types/string.md)
+- `query` - The SQL query to be formatted. [String](../data-types/string.md)
**Returned value**
-- The formatted query. [String](../../sql-reference/data-types/string.md).
+- The formatted query. [String](../data-types/string.md).
**Example**
@@ -3214,8 +3300,8 @@ variantElement(variant, type_name, [, default_value])
**Arguments**
-- `variant` — Variant column. [Variant](../../sql-reference/data-types/variant.md).
-- `type_name` — The name of the variant type to extract. [String](../../sql-reference/data-types/string.md).
+- `variant` — Variant column. [Variant](../data-types/variant.md).
+- `type_name` — The name of the variant type to extract. [String](../data-types/string.md).
- `default_value` - The default value that will be used if variant doesn't have variant with specified type. Can be any type. Optional.
**Returned value**
@@ -3251,7 +3337,7 @@ variantType(variant)
**Arguments**
-- `variant` — Variant column. [Variant](../../sql-reference/data-types/variant.md).
+- `variant` — Variant column. [Variant](../data-types/variant.md).
**Returned value**
@@ -3467,7 +3553,7 @@ showCertificate()
**Returned value**
-- Map of key-value pairs relating to the configured SSL certificate. [Map](../../sql-reference/data-types/map.md)([String](../../sql-reference/data-types/string.md), [String](../../sql-reference/data-types/string.md)).
+- Map of key-value pairs relating to the configured SSL certificate. [Map](../data-types/map.md)([String](../data-types/string.md), [String](../data-types/string.md)).
**Example**
diff --git a/docs/en/sql-reference/functions/random-functions.md b/docs/en/sql-reference/functions/random-functions.md
index 2d7752ed022..a9b483aa0e5 100644
--- a/docs/en/sql-reference/functions/random-functions.md
+++ b/docs/en/sql-reference/functions/random-functions.md
@@ -169,7 +169,7 @@ randUniform(min, max)
### Returned value
-A random number of type [Float64](/docs/en/sql-reference/data-types/float.md).
+A random number of type [Float64](../data-types/float.md).
### Example
@@ -204,9 +204,7 @@ randNormal(mean, variance)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -243,9 +241,7 @@ randLogNormal(mean, variance)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -282,9 +278,7 @@ randBinomial(experiments, probability)
**Returned value**
-- Random number.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Random number. [UInt64](../data-types/int-uint.md).
**Example**
@@ -321,9 +315,7 @@ randNegativeBinomial(experiments, probability)
**Returned value**
-- Random number.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Random number. [UInt64](../data-types/int-uint.md).
**Example**
@@ -359,9 +351,7 @@ randPoisson(n)
**Returned value**
-- Random number.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Random number. [UInt64](../data-types/int-uint.md).
**Example**
@@ -397,9 +387,7 @@ randBernoulli(probability)
**Returned value**
-- Random number.
-
-Type: [UInt64](/docs/en/sql-reference/data-types/int-uint.md).
+- Random number. [UInt64](../data-types/int-uint.md).
**Example**
@@ -435,9 +423,7 @@ randExponential(lambda)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -473,9 +459,7 @@ randChiSquared(degree_of_freedom)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -511,9 +495,7 @@ randStudentT(degree_of_freedom)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -550,9 +532,7 @@ randFisherF(d1, d2)
**Returned value**
-- Random number.
-
-Type: [Float64](/docs/en/sql-reference/data-types/float.md).
+- Random number. [Float64](../data-types/float.md).
**Example**
@@ -588,9 +568,7 @@ randomString(length)
**Returned value**
-- String filled with random bytes.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- String filled with random bytes. [String](../data-types/string.md).
**Example**
@@ -626,13 +604,11 @@ randomFixedString(length);
**Arguments**
-- `length` — String length in bytes. [UInt64](../../sql-reference/data-types/int-uint.md).
+- `length` — String length in bytes. [UInt64](../data-types/int-uint.md).
**Returned value(s)**
-- String filled with random bytes.
-
-Type: [FixedString](../../sql-reference/data-types/fixedstring.md).
+- String filled with random bytes. [FixedString](../data-types/fixedstring.md).
**Example**
@@ -667,9 +643,7 @@ randomPrintableASCII(length)
**Returned value**
-- String with a random set of [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) printable characters.
-
-Type: [String](../../sql-reference/data-types/string.md)
+- String with a random set of [ASCII](https://en.wikipedia.org/wiki/ASCII#Printable_characters) printable characters. [String](../data-types/string.md)
**Example**
@@ -697,13 +671,11 @@ randomStringUTF8(length);
**Arguments**
-- `length` — Length of the string in code points. [UInt64](../../sql-reference/data-types/int-uint.md).
+- `length` — Length of the string in code points. [UInt64](../data-types/int-uint.md).
**Returned value(s)**
-- UTF-8 random string.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- UTF-8 random string. [String](../data-types/string.md).
**Example**
diff --git a/docs/en/sql-reference/functions/rounding-functions.md b/docs/en/sql-reference/functions/rounding-functions.md
index afec43cd6f4..d18185c5013 100644
--- a/docs/en/sql-reference/functions/rounding-functions.md
+++ b/docs/en/sql-reference/functions/rounding-functions.md
@@ -36,8 +36,8 @@ Alias: `truncate`.
**Parameters**
-- `input`: A numeric type ([Float](/docs/en/sql-reference/data-types/float.md), [Decimal](/docs/en/sql-reference/data-types/decimal.md) or [Integer](/docs/en/sql-reference/data-types/int-uint.md)).
-- `precision`: An [Integer](/docs/en/sql-reference/data-types/int-uint.md) type.
+- `input`: A numeric type ([Float](../data-types/float.md), [Decimal](../data-types/decimal.md) or [Integer](../data-types/int-uint.md)).
+- `precision`: An [Integer](../data-types/int-uint.md) type.
**Returned value**
@@ -69,7 +69,7 @@ round(expression [, decimal_places])
**Arguments**
-- `expression` — A number to be rounded. Can be any [expression](../../sql-reference/syntax.md#syntax-expressions) returning the numeric [data type](../../sql-reference/data-types/index.md#data_types).
+- `expression` — A number to be rounded. Can be any [expression](../../sql-reference/syntax.md#syntax-expressions) returning the numeric [data type](../data-types/index.md#data_types).
- `decimal-places` — An integer value.
- If `decimal-places > 0` then the function rounds the value to the right of the decimal point.
- If `decimal-places < 0` then the function rounds the value to the left of the decimal point.
@@ -171,7 +171,7 @@ roundBankers(expression [, decimal_places])
**Arguments**
-- `expression` — A number to be rounded. Can be any [expression](../../sql-reference/syntax.md#syntax-expressions) returning the numeric [data type](../../sql-reference/data-types/index.md#data_types).
+- `expression` — A number to be rounded. Can be any [expression](../../sql-reference/syntax.md#syntax-expressions) returning the numeric [data type](../data-types/index.md#data_types).
- `decimal-places` — Decimal places. An integer number.
- `decimal-places > 0` — The function rounds the number to the given position right of the decimal point. Example: `roundBankers(3.55, 1) = 3.6`.
- `decimal-places < 0` — The function rounds the number to the given position left of the decimal point. Example: `roundBankers(24.55, -1) = 20`.
diff --git a/docs/en/sql-reference/functions/splitting-merging-functions.md b/docs/en/sql-reference/functions/splitting-merging-functions.md
index 8e50637cf30..20d63d84628 100644
--- a/docs/en/sql-reference/functions/splitting-merging-functions.md
+++ b/docs/en/sql-reference/functions/splitting-merging-functions.md
@@ -19,20 +19,20 @@ splitByChar(separator, s[, max_substrings]))
**Arguments**
-- `separator` — The separator which should contain exactly one character. [String](../../sql-reference/data-types/string.md).
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `separator` — The separator which should contain exactly one character. [String](../data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. If `max_substrings` > 0, the returned array will contain at most `max_substrings` substrings, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings. Empty substrings may be selected when:
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
+
+ Empty substrings may be selected when:
- A separator occurs at the beginning or end of the string;
- There are multiple consecutive separators;
- The original string `s` is empty.
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
-
:::note
The behavior of parameter `max_substrings` changed starting with ClickHouse v22.11. In versions older than that, `max_substrings > 0` meant that `max_substring`-many splits were performed and that the remainder of the string was returned as the final element of the list.
For example,
@@ -70,21 +70,23 @@ splitByString(separator, s[, max_substrings]))
**Arguments**
-- `separator` — The separator. [String](../../sql-reference/data-types/string.md).
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `separator` — The separator. [String](../data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. When `max_substrings` > 0, the returned substrings will be no more than `max_substrings`, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings. Empty substrings may be selected when:
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+Empty substrings may be selected when:
- A non-empty separator occurs at the beginning or end of the string;
- There are multiple consecutive non-empty separators;
- The original string `s` is empty while the separator is not empty.
+:::note
Setting [splitby_max_substrings_includes_remaining_string](../../operations/settings/settings.md#splitby_max_substrings_includes_remaining_string) (default: 0) controls if the remaining string is included in the last element of the result array when argument `max_substrings` > 0.
+:::
**Example**
@@ -125,21 +127,24 @@ splitByRegexp(regexp, s[, max_substrings]))
**Arguments**
- `regexp` — Regular expression. Constant. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. When `max_substrings` > 0, the returned substrings will be no more than `max_substrings`, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings. Empty substrings may be selected when:
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
+
+
+Empty substrings may be selected when:
- A non-empty regular expression match occurs at the beginning or end of the string;
- There are multiple consecutive non-empty regular expression matches;
- The original string `s` is empty while the regular expression is not empty.
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
-
+:::note
Setting [splitby_max_substrings_includes_remaining_string](../../operations/settings/settings.md#splitby_max_substrings_includes_remaining_string) (default: 0) controls if the remaining string is included in the last element of the result array when argument `max_substrings` > 0.
+:::
**Example**
@@ -180,17 +185,17 @@ splitByWhitespace(s[, max_substrings]))
**Arguments**
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. When `max_substrings` > 0, the returned substrings will be no more than `max_substrings`, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
-
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
+
+:::note
Setting [splitby_max_substrings_includes_remaining_string](../../operations/settings/settings.md#splitby_max_substrings_includes_remaining_string) (default: 0) controls if the remaining string is included in the last element of the result array when argument `max_substrings` > 0.
+:::
**Example**
@@ -219,17 +224,17 @@ splitByNonAlpha(s[, max_substrings]))
**Arguments**
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. When `max_substrings` > 0, the returned substrings will be no more than `max_substrings`, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
+:::note
Setting [splitby_max_substrings_includes_remaining_string](../../operations/settings/settings.md#splitby_max_substrings_includes_remaining_string) (default: 0) controls if the remaining string is included in the last element of the result array when argument `max_substrings` > 0.
+:::
**Example**
@@ -282,16 +287,16 @@ Alias: `splitByAlpha`
**Arguments**
-- `s` — The string to split. [String](../../sql-reference/data-types/string.md).
+- `s` — The string to split. [String](../data-types/string.md).
- `max_substrings` — An optional `Int64` defaulting to 0. When `max_substrings` > 0, the returned substrings will be no more than `max_substrings`, otherwise the function will return as many substrings as possible.
**Returned value(s)**
-Returns an array of selected substrings.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- An array of selected substrings. [Array](../data-types/array.md)([String](../data-types/string.md)).
+:::note
Setting [splitby_max_substrings_includes_remaining_string](../../operations/settings/settings.md#splitby_max_substrings_includes_remaining_string) (default: 0) controls if the remaining string is included in the last element of the result array when argument `max_substrings` > 0.
+:::
**Example**
@@ -322,11 +327,7 @@ extractAllGroups(text, regexp)
**Returned values**
-- If the function finds at least one matching group, it returns `Array(Array(String))` column, clustered by group_id (1 to N, where N is number of capturing groups in `regexp`).
-
-- If there is no matching group, returns an empty array.
-
-Type: [Array](../data-types/array.md).
+- If the function finds at least one matching group, it returns `Array(Array(String))` column, clustered by group_id (1 to N, where N is number of capturing groups in `regexp`). If there is no matching group, it returns an empty array. [Array](../data-types/array.md).
**Example**
@@ -354,14 +355,12 @@ ngrams(string, ngramsize)
**Arguments**
-- `string` — String. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `ngramsize` — The size of an n-gram. [UInt](../../sql-reference/data-types/int-uint.md).
+- `string` — String. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `ngramsize` — The size of an n-gram. [UInt](../data-types/int-uint.md).
**Returned values**
-- Array with n-grams.
-
-Type: [Array](../../sql-reference/data-types/array.md)([String](../../sql-reference/data-types/string.md)).
+- Array with n-grams. [Array](../data-types/array.md)([String](../data-types/string.md)).
**Example**
@@ -383,13 +382,11 @@ Splits a string into tokens using non-alphanumeric ASCII characters as separator
**Arguments**
-- `input_string` — Any set of bytes represented as the [String](../../sql-reference/data-types/string.md) data type object.
+- `input_string` — Any set of bytes represented as the [String](../data-types/string.md) data type object.
**Returned value**
-- The resulting array of tokens from input string.
-
-Type: [Array](../data-types/array.md).
+- The resulting array of tokens from input string. [Array](../data-types/array.md).
**Example**
diff --git a/docs/en/sql-reference/functions/string-functions.md b/docs/en/sql-reference/functions/string-functions.md
index ba23870a584..342ca2b9f03 100644
--- a/docs/en/sql-reference/functions/string-functions.md
+++ b/docs/en/sql-reference/functions/string-functions.md
@@ -30,9 +30,7 @@ empty(x)
**Returned value**
-- Returns `1` for an empty string or `0` for a non-empty string.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for an empty string or `0` for a non-empty string. [UInt8](../data-types/int-uint.md).
**Example**
@@ -68,9 +66,7 @@ notEmpty(x)
**Returned value**
-- Returns `1` for a non-empty string or `0` for an empty string string.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for a non-empty string or `0` for an empty string string. [UInt8](../data-types/int-uint.md).
**Example**
@@ -187,7 +183,7 @@ left(s, offset)
**Parameters**
-- `s`: The string to calculate a substring from. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `s`: The string to calculate a substring from. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
- `offset`: The number of bytes of the offset. [UInt*](../data-types/int-uint).
**Returned value**
@@ -234,7 +230,7 @@ leftUTF8(s, offset)
**Parameters**
-- `s`: The UTF-8 encoded string to calculate a substring from. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `s`: The UTF-8 encoded string to calculate a substring from. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
- `offset`: The number of bytes of the offset. [UInt*](../data-types/int-uint).
**Returned value**
@@ -289,9 +285,7 @@ Alias: `LPAD`
**Returned value**
-- A left-padded string of the given length.
-
-Type: [String](../data-types/string.md).
+- A left-padded string of the given length. [String](../data-types/string.md).
**Example**
@@ -325,9 +319,7 @@ leftPadUTF8(string, length[, pad_string])
**Returned value**
-- A left-padded string of the given length.
-
-Type: [String](../data-types/string.md).
+- A left-padded string of the given length. [String](../data-types/string.md).
**Example**
@@ -355,7 +347,7 @@ right(s, offset)
**Parameters**
-- `s`: The string to calculate a substring from. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `s`: The string to calculate a substring from. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
- `offset`: The number of bytes of the offset. [UInt*](../data-types/int-uint).
**Returned value**
@@ -402,7 +394,7 @@ rightUTF8(s, offset)
**Parameters**
-- `s`: The UTF-8 encoded string to calculate a substring from. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `s`: The UTF-8 encoded string to calculate a substring from. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
- `offset`: The number of bytes of the offset. [UInt*](../data-types/int-uint).
**Returned value**
@@ -457,9 +449,7 @@ Alias: `RPAD`
**Returned value**
-- A left-padded string of the given length.
-
-Type: [String](../data-types/string.md).
+- A left-padded string of the given length. [String](../data-types/string.md).
**Example**
@@ -493,9 +483,7 @@ rightPadUTF8(string, length[, pad_string])
**Returned value**
-- A right-padded string of the given length.
-
-Type: [String](../data-types/string.md).
+- A right-padded string of the given length. [String](../data-types/string.md).
**Example**
@@ -525,11 +513,11 @@ Alias: `lcase`
**Parameters**
-- `input`: A string type [String](/docs/en/sql-reference/data-types/string.md).
+- `input`: A string type [String](../data-types/string.md).
**Returned value**
-- A [String](/docs/en/sql-reference/data-types/string.md) data type value.
+- A [String](../data-types/string.md) data type value.
**Example**
@@ -559,11 +547,11 @@ Alias: `ucase`
**Parameters**
-- `input`: A string type [String](/docs/en/sql-reference/data-types/string.md).
+- `input`: A string type [String](../data-types/string.md).
**Returned value**
-- A [String](/docs/en/sql-reference/data-types/string.md) data type value.
+- A [String](../data-types/string.md) data type value.
**Examples**
@@ -603,11 +591,11 @@ upperUTF8(input)
**Parameters**
-- `input`: A string type [String](/docs/en/sql-reference/data-types/string.md).
+- `input`: A string type [String](../data-types/string.md).
**Returned value**
-- A [String](/docs/en/sql-reference/data-types/string.md) data type value.
+- A [String](../data-types/string.md) data type value.
**Example**
@@ -639,7 +627,7 @@ toValidUTF8(input_string)
**Arguments**
-- `input_string` — Any set of bytes represented as the [String](../../sql-reference/data-types/string.md) data type object.
+- `input_string` — Any set of bytes represented as the [String](../data-types/string.md) data type object.
**Returned value**
@@ -671,14 +659,12 @@ Alias: `REPEAT`
**Arguments**
-- `s` — The string to repeat. [String](../../sql-reference/data-types/string.md).
-- `n` — The number of times to repeat the string. [UInt* or Int*](../../sql-reference/data-types/int-uint.md).
+- `s` — The string to repeat. [String](../data-types/string.md).
+- `n` — The number of times to repeat the string. [UInt* or Int*](../data-types/int-uint.md).
**Returned value**
-A string containing string `s` repeated `n` times. If `n` <= 0, the function returns the empty string.
-
-Type: `String`.
+A string containing string `s` repeated `n` times. If `n` <= 0, the function returns the empty string. [String](../data-types/string.md).
**Example**
@@ -708,13 +694,11 @@ Alias: `SPACE`.
**Arguments**
-- `n` — The number of times to repeat the space. [UInt* or Int*](../../sql-reference/data-types/int-uint.md).
+- `n` — The number of times to repeat the space. [UInt* or Int*](../data-types/int-uint.md).
**Returned value**
-The string containing string ` ` repeated `n` times. If `n` <= 0, the function returns the empty string.
-
-Type: `String`.
+The string containing string ` ` repeated `n` times. If `n` <= 0, the function returns the empty string. [String](../data-types/string.md).
**Example**
@@ -754,7 +738,7 @@ concat(s1, s2, ...)
At least one value of arbitrary type.
-Arguments which are not of types [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md) are converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.
+Arguments which are not of types [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md) are converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.
**Returned values**
@@ -861,8 +845,8 @@ Alias: `concat_ws`
**Arguments**
-- sep — separator. Const [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- exprN — expression to be concatenated. Arguments which are not of types [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md) are converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.
+- sep — separator. Const [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- exprN — expression to be concatenated. Arguments which are not of types [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md) are converted to strings using their default serialization. As this decreases performance, it is not recommended to use non-String/FixedString arguments.
**Returned values**
@@ -907,15 +891,13 @@ Alias:
**Arguments**
-- `s` — The string to calculate a substring from. [String](../../sql-reference/data-types/string.md), [FixedString](../../sql-reference/data-types/fixedstring.md) or [Enum](../../sql-reference/data-types/enum.md)
-- `offset` — The starting position of the substring in `s` . [(U)Int*](../../sql-reference/data-types/int-uint.md).
-- `length` — The maximum length of the substring. [(U)Int*](../../sql-reference/data-types/int-uint.md). Optional.
+- `s` — The string to calculate a substring from. [String](../data-types/string.md), [FixedString](../data-types/fixedstring.md) or [Enum](../data-types/enum.md)
+- `offset` — The starting position of the substring in `s` . [(U)Int*](../data-types/int-uint.md).
+- `length` — The maximum length of the substring. [(U)Int*](../data-types/int-uint.md). Optional.
**Returned value**
-A substring of `s` with `length` many bytes, starting at index `offset`.
-
-Type: `String`.
+A substring of `s` with `length` many bytes, starting at index `offset`. [String](../data-types/string.md).
**Example**
@@ -945,9 +927,9 @@ substringUTF8(s, offset[, length])
**Arguments**
-- `s`: The string to calculate a substring from. [String](../../sql-reference/data-types/string.md), [FixedString](../../sql-reference/data-types/fixedstring.md) or [Enum](../../sql-reference/data-types/enum.md)
-- `offset`: The starting position of the substring in `s` . [(U)Int*](../../sql-reference/data-types/int-uint.md).
-- `length`: The maximum length of the substring. [(U)Int*](../../sql-reference/data-types/int-uint.md). Optional.
+- `s`: The string to calculate a substring from. [String](../data-types/string.md), [FixedString](../data-types/fixedstring.md) or [Enum](../data-types/enum.md)
+- `offset`: The starting position of the substring in `s` . [(U)Int*](../data-types/int-uint.md).
+- `length`: The maximum length of the substring. [(U)Int*](../data-types/int-uint.md). Optional.
**Returned value**
@@ -983,8 +965,8 @@ Alias: `SUBSTRING_INDEX`
**Arguments**
-- s: The string to extract substring from. [String](../../sql-reference/data-types/string.md).
-- delim: The character to split. [String](../../sql-reference/data-types/string.md).
+- s: The string to extract substring from. [String](../data-types/string.md).
+- delim: The character to split. [String](../data-types/string.md).
- count: The number of occurrences of the delimiter to count before extracting the substring. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. [UInt or Int](../data-types/int-uint.md)
**Example**
@@ -1014,13 +996,13 @@ substringIndexUTF8(s, delim, count)
**Arguments**
-- `s`: The string to extract substring from. [String](../../sql-reference/data-types/string.md).
-- `delim`: The character to split. [String](../../sql-reference/data-types/string.md).
+- `s`: The string to extract substring from. [String](../data-types/string.md).
+- `delim`: The character to split. [String](../data-types/string.md).
- `count`: The number of occurrences of the delimiter to count before extracting the substring. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. [UInt or Int](../data-types/int-uint.md)
**Returned value**
-A substring [String](../../sql-reference/data-types/string.md) of `s` before `count` occurrences of `delim`.
+A substring [String](../data-types/string.md) of `s` before `count` occurrences of `delim`.
**Implementation details**
@@ -1068,13 +1050,11 @@ base58Encode(plaintext)
**Arguments**
-- `plaintext` — [String](../../sql-reference/data-types/string.md) column or constant.
+- `plaintext` — [String](../data-types/string.md) column or constant.
**Returned value**
-- A string containing the encoded value of the argument.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A string containing the encoded value of the argument. [String](../data-types/string.md).
**Example**
@@ -1102,13 +1082,11 @@ base58Decode(encoded)
**Arguments**
-- `encoded` — [String](../../sql-reference/data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, an exception is thrown.
+- `encoded` — [String](../data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, an exception is thrown.
**Returned value**
-- A string containing the decoded value of the argument.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- A string containing the decoded value of the argument. [String](../data-types/string.md).
**Example**
@@ -1136,7 +1114,7 @@ tryBase58Decode(encoded)
**Parameters**
-- `encoded`: [String](../../sql-reference/data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, returns an empty string in case of error.
+- `encoded`: [String](../data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, returns an empty string in case of error.
**Returned value**
@@ -1180,7 +1158,7 @@ tryBase64Decode(encoded)
**Parameters**
-- `encoded`: [String](../../sql-reference/data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, returns an empty string in case of error.
+- `encoded`: [String](../data-types/string.md) column or constant. If the string is not a valid Base58-encoded value, returns an empty string in case of error.
**Examples**
@@ -1279,14 +1257,12 @@ trim([[LEADING|TRAILING|BOTH] trim_character FROM] input_string)
**Arguments**
-- `trim_character` — Specified characters for trim. [String](../../sql-reference/data-types/string.md).
-- `input_string` — String for trim. [String](../../sql-reference/data-types/string.md).
+- `trim_character` — Specified characters for trim. [String](../data-types/string.md).
+- `input_string` — String for trim. [String](../data-types/string.md).
**Returned value**
-A string without leading and/or trailing specified characters.
-
-Type: `String`.
+A string without leading and/or trailing specified characters. [String](../data-types/string.md).
**Example**
@@ -1316,13 +1292,11 @@ Alias: `ltrim(input_string)`.
**Arguments**
-- `input_string` — string to trim. [String](../../sql-reference/data-types/string.md).
+- `input_string` — string to trim. [String](../data-types/string.md).
**Returned value**
-A string without leading common whitespaces.
-
-Type: `String`.
+A string without leading common whitespaces. [String](../data-types/string.md).
**Example**
@@ -1352,13 +1326,11 @@ Alias: `rtrim(input_string)`.
**Arguments**
-- `input_string` — string to trim. [String](../../sql-reference/data-types/string.md).
+- `input_string` — string to trim. [String](../data-types/string.md).
**Returned value**
-A string without trailing common whitespaces.
-
-Type: `String`.
+A string without trailing common whitespaces. [String](../data-types/string.md).
**Example**
@@ -1388,13 +1360,11 @@ Alias: `trim(input_string)`.
**Arguments**
-- `input_string` — string to trim. [String](../../sql-reference/data-types/string.md).
+- `input_string` — string to trim. [String](../data-types/string.md).
**Returned value**
-A string without leading and trailing common whitespaces.
-
-Type: `String`.
+A string without leading and trailing common whitespaces. [String](../data-types/string.md).
**Example**
@@ -1440,13 +1410,11 @@ normalizeQuery(x)
**Arguments**
-- `x` — Sequence of characters. [String](../../sql-reference/data-types/string.md).
+- `x` — Sequence of characters. [String](../data-types/string.md).
**Returned value**
-- Sequence of characters with placeholders.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Sequence of characters with placeholders. [String](../data-types/string.md).
**Example**
@@ -1474,13 +1442,11 @@ normalizedQueryHash(x)
**Arguments**
-- `x` — Sequence of characters. [String](../../sql-reference/data-types/string.md).
+- `x` — Sequence of characters. [String](../data-types/string.md).
**Returned value**
-- Hash value.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges).
+- Hash value. [UInt64](../data-types/int-uint.md#uint-ranges).
**Example**
@@ -1508,13 +1474,11 @@ normalizeUTF8NFC(words)
**Arguments**
-- `words` — UTF8-encoded input string. [String](../../sql-reference/data-types/string.md).
+- `words` — UTF8-encoded input string. [String](../data-types/string.md).
**Returned value**
-- String transformed to NFC normalization form.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- String transformed to NFC normalization form. [String](../data-types/string.md).
**Example**
@@ -1542,13 +1506,11 @@ normalizeUTF8NFD(words)
**Arguments**
-- `words` — UTF8-encoded input string. [String](../../sql-reference/data-types/string.md).
+- `words` — UTF8-encoded input string. [String](../data-types/string.md).
**Returned value**
-- String transformed to NFD normalization form.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- String transformed to NFD normalization form. [String](../data-types/string.md).
**Example**
@@ -1576,13 +1538,11 @@ normalizeUTF8NFKC(words)
**Arguments**
-- `words` — UTF8-encoded input string. [String](../../sql-reference/data-types/string.md).
+- `words` — UTF8-encoded input string. [String](../data-types/string.md).
**Returned value**
-- String transformed to NFKC normalization form.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- String transformed to NFKC normalization form. [String](../data-types/string.md).
**Example**
@@ -1610,13 +1570,11 @@ normalizeUTF8NFKD(words)
**Arguments**
-- `words` — UTF8-encoded input string. [String](../../sql-reference/data-types/string.md).
+- `words` — UTF8-encoded input string. [String](../data-types/string.md).
**Returned value**
-- String transformed to NFKD normalization form.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- String transformed to NFKD normalization form. [String](../data-types/string.md).
**Example**
@@ -1647,13 +1605,11 @@ encodeXMLComponent(x)
**Arguments**
-- `x` — An input string. [String](../../sql-reference/data-types/string.md).
+- `x` — An input string. [String](../data-types/string.md).
**Returned value**
-- The escaped string.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- The escaped string. [String](../data-types/string.md).
**Example**
@@ -1687,13 +1643,11 @@ decodeXMLComponent(x)
**Arguments**
-- `x` — An input string. [String](../../sql-reference/data-types/string.md).
+- `x` — An input string. [String](../data-types/string.md).
**Returned value**
-- The un-escaped string.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- The un-escaped string. [String](../data-types/string.md).
**Example**
@@ -1723,13 +1677,11 @@ decodeHTMLComponent(x)
**Arguments**
-- `x` — An input string. [String](../../sql-reference/data-types/string.md).
+- `x` — An input string. [String](../data-types/string.md).
**Returned value**
-- The un-escaped string.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- The un-escaped string. [String](../data-types/string.md).
**Example**
@@ -1778,13 +1730,11 @@ extractTextFromHTML(x)
**Arguments**
-- `x` — input text. [String](../../sql-reference/data-types/string.md).
+- `x` — input text. [String](../data-types/string.md).
**Returned value**
-- Extracted text.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Extracted text. [String](../data-types/string.md).
**Example**
diff --git a/docs/en/sql-reference/functions/string-replace-functions.md b/docs/en/sql-reference/functions/string-replace-functions.md
index 0b761b62006..7aeb1f5b2a7 100644
--- a/docs/en/sql-reference/functions/string-replace-functions.md
+++ b/docs/en/sql-reference/functions/string-replace-functions.md
@@ -139,7 +139,7 @@ Format the `pattern` string with the values (strings, integers, etc.) listed in
**Syntax**
```sql
-format(pattern, s0, s1, …)
+format(pattern, s0, s1, ...)
```
**Example**
@@ -202,13 +202,13 @@ translateUTF8(s, from, to)
**Parameters**
-- `s`: A string type [String](/docs/en/sql-reference/data-types/string.md).
-- `from`: A string type [String](/docs/en/sql-reference/data-types/string.md).
-- `to`: A string type [String](/docs/en/sql-reference/data-types/string.md).
+- `s`: A string type [String](../data-types/string.md).
+- `from`: A string type [String](../data-types/string.md).
+- `to`: A string type [String](../data-types/string.md).
**Returned value**
-- A [String](/docs/en/sql-reference/data-types/string.md) data type value.
+- A [String](../data-types/string.md) data type value.
**Examples**
diff --git a/docs/en/sql-reference/functions/string-search-functions.md b/docs/en/sql-reference/functions/string-search-functions.md
index 9738c19bf3c..d261cff3580 100644
--- a/docs/en/sql-reference/functions/string-search-functions.md
+++ b/docs/en/sql-reference/functions/string-search-functions.md
@@ -17,7 +17,7 @@ Functions in this section also assume that the searched string (referred to in t
violated, no exception is thrown and results are undefined. Search with UTF-8 encoded strings is usually provided by separate function
variants. Likewise, if a UTF-8 function variant is used and the input strings are not UTF-8 encoded text, no exception is thrown and the
results are undefined. Note that no automatic Unicode normalization is performed, however you can use the
-[normalizeUTF8*()](https://clickhouse.com/docs/en/sql-reference/functions/string-functions/) functions for that.
+[normalizeUTF8*()](https://clickhouse.com../functions/string-functions/) functions for that.
[General strings functions](string-functions.md) and [functions for replacing in strings](string-replace-functions.md) are described separately.
@@ -38,12 +38,12 @@ Alias:
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../../sql-reference/data-types/int-uint.md). Optional.
+- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../data-types/int-uint.md). Optional.
-**Returned values**
+**Returned value**
-- Starting position in bytes and counting from 1, if the substring was found.
-- 0, if the substring was not found.
+- Starting position in bytes and counting from 1, if the substring was found. [UInt64](../data-types/int-uint.md).
+- 0, if the substring was not found. [UInt64](../data-types/int-uint.md).
If substring `needle` is empty, these rules apply:
- if no `start_pos` was specified: return `1`
@@ -53,8 +53,6 @@ If substring `needle` is empty, these rules apply:
The same rules also apply to functions `locate`, `positionCaseInsensitive`, `positionUTF8` and `positionCaseInsensitiveUTF8`.
-Type: `Integer`.
-
**Examples**
Query:
@@ -206,9 +204,9 @@ multiSearchAllPositions(haystack, [needle1, needle2, ..., needleN])
**Arguments**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
-**Returned values**
+**Returned value**
- Array of the starting position in bytes and counting from 1, if the substring was found.
- 0, if the substring was not found.
@@ -241,7 +239,7 @@ multiSearchAllPositionsCaseInsensitive(haystack, [needle1, needle2, ..., needleN
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -275,7 +273,7 @@ multiSearchAllPositionsUTF8(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — UTF-8 encoded string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — UTF-8 encoded substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — UTF-8 encoded substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -311,7 +309,7 @@ multiSearchAllPositionsCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., nee
**Parameters**
- `haystack` — UTF-8 encoded string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — UTF-8 encoded substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — UTF-8 encoded substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -349,7 +347,7 @@ multiSearchFirstPosition(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -383,7 +381,7 @@ multiSearchFirstPositionCaseInsensitive(haystack, [needle1, needle2, ..., needle
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Array of substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Array of substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -417,7 +415,7 @@ multiSearchFirstPositionUTF8(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Array of UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Array of UTF-8 substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -453,7 +451,7 @@ multiSearchFirstPositionCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., ne
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Array of UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md)
+- `needle` — Array of UTF-8 substrings to be searched. [Array](../data-types/array.md)
**Returned value**
@@ -490,12 +488,11 @@ multiSearchFirstIndex(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
**Returned value**
-- index (starting from 1) of the leftmost found needle.
-- 0, if there was no match.
+- index (starting from 1) of the leftmost found needle. Otherwise 0, if there was no match. [UInt8](../data-types/int-uint.md).
**Example**
@@ -524,12 +521,11 @@ multiSearchFirstIndexCaseInsensitive(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
**Returned value**
-- index (starting from 1) of the leftmost found needle.
-- 0, if there was no match.
+- index (starting from 1) of the leftmost found needle. Otherwise 0, if there was no match. [UInt8](../data-types/int-uint.md).
**Example**
@@ -558,12 +554,11 @@ multiSearchFirstIndexUTF8(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Array of UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md)
+- `needle` — Array of UTF-8 substrings to be searched. [Array](../data-types/array.md)
**Returned value**
-- index (starting from 1) of the leftmost found needle.
-- 0, if there was no match.
+- index (starting from 1) of the leftmost found needle, Otherwise 0, if there was no match. [UInt8](../data-types/int-uint.md).
**Example**
@@ -594,12 +589,11 @@ multiSearchFirstIndexCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needl
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Array of UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Array of UTF-8 substrings to be searched. [Array](../data-types/array.md).
**Returned value**
-- index (starting from 1) of the leftmost found needle.
-- 0, if there was no match.
+- index (starting from 1) of the leftmost found needle. Otherwise 0, if there was no match. [UInt8](../data-types/int-uint.md).
**Example**
@@ -632,7 +626,7 @@ multiSearchAny(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — Substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -666,7 +660,7 @@ multiSearchAnyCaseInsensitive(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — Substrings to be searched. [Array](../../sql-reference/data-types/array.md)
+- `needle` — Substrings to be searched. [Array](../data-types/array.md)
**Returned value**
@@ -700,7 +694,7 @@ multiSearchAnyUTF8(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md).
+- `needle` — UTF-8 substrings to be searched. [Array](../data-types/array.md).
**Returned value**
@@ -736,7 +730,7 @@ multiSearchAnyCaseInsensitiveUTF8(haystack, [needle1, needle2, ..., needleN])
**Parameters**
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `needle` — UTF-8 substrings to be searched. [Array](../../sql-reference/data-types/array.md)
+- `needle` — UTF-8 substrings to be searched. [Array](../data-types/array.md)
**Returned value**
@@ -799,7 +793,7 @@ If you only want to search multiple substrings in a string, you can use function
**Syntax**
```sql
-multiMatchAny(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAny(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiMatchAnyIndex
@@ -809,7 +803,7 @@ Like `multiMatchAny` but returns any index that matches the haystack.
**Syntax**
```sql
-multiMatchAnyIndex(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAnyIndex(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiMatchAllIndices
@@ -819,7 +813,7 @@ Like `multiMatchAny` but returns the array of all indices that match the haystac
**Syntax**
```sql
-multiMatchAllIndices(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAllIndices(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAny
@@ -833,7 +827,7 @@ Like `multiMatchAny` but returns 1 if any pattern matches the haystack within a
**Syntax**
```sql
-multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, …, patternn\])
+multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAnyIndex
@@ -843,7 +837,7 @@ Like `multiFuzzyMatchAny` but returns any index that matches the haystack within
**Syntax**
```sql
-multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, …, patternn\])
+multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAllIndices
@@ -853,7 +847,7 @@ Like `multiFuzzyMatchAny` but returns the array of all indices in any order that
**Syntax**
```sql
-multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, …, patternn\])
+multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## extract
@@ -896,14 +890,16 @@ extractAllGroupsHorizontal(haystack, pattern)
**Arguments**
-- `haystack` — Input string. Type: [String](../../sql-reference/data-types/string.md).
-- `pattern` — Regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). Must contain groups, each group enclosed in parentheses. If `pattern` contains no groups, an exception is thrown. Type: [String](../../sql-reference/data-types/string.md).
+- `haystack` — Input string. [String](../data-types/string.md).
+- `pattern` — Regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). Must contain groups, each group enclosed in parentheses. If `pattern` contains no groups, an exception is thrown. [String](../data-types/string.md).
**Returned value**
-- Type: [Array](../../sql-reference/data-types/array.md).
+- Array of arrays of matches. [Array](../data-types/array.md).
+:::note
If `haystack` does not match the `pattern` regex, an array of empty arrays is returned.
+:::
**Example**
@@ -931,14 +927,16 @@ extractAllGroupsVertical(haystack, pattern)
**Arguments**
-- `haystack` — Input string. Type: [String](../../sql-reference/data-types/string.md).
-- `pattern` — Regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). Must contain groups, each group enclosed in parentheses. If `pattern` contains no groups, an exception is thrown. Type: [String](../../sql-reference/data-types/string.md).
+- `haystack` — Input string. [String](../data-types/string.md).
+- `pattern` — Regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). Must contain groups, each group enclosed in parentheses. If `pattern` contains no groups, an exception is thrown. [String](../data-types/string.md).
**Returned value**
-- Type: [Array](../../sql-reference/data-types/array.md).
+- Array of arrays of matches. [Array](../data-types/array.md).
+:::note
If `haystack` does not match the `pattern` regex, an empty array is returned.
+:::
**Example**
@@ -968,7 +966,7 @@ Matching is based on UTF-8, e.g. `_` matches the Unicode code point `¥` which i
If the haystack or the LIKE expression are not valid UTF-8, the behavior is undefined.
-No automatic Unicode normalization is performed, you can use the [normalizeUTF8*()](https://clickhouse.com/docs/en/sql-reference/functions/string-functions/) functions for that.
+No automatic Unicode normalization is performed, you can use the [normalizeUTF8*()](https://clickhouse.com../functions/string-functions/) functions for that.
To match against literal `%`, `_` and `\` (which are LIKE metacharacters), prepend them with a backslash: `\%`, `\_` and `\\`.
The backslash loses its special meaning (i.e. is interpreted literally) if it prepends a character different than `%`, `_` or `\`.
@@ -1005,7 +1003,7 @@ Alias: `haystack NOT ILIKE pattern` (operator)
## ngramDistance
-Calculates the 4-gram distance between a `haystack` string and a `needle` string. For this, it counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns a [Float32](../../sql-reference/data-types/float.md/#float32-float64) between 0 and 1. The smaller the result is, the more similar the strings are to each other.
+Calculates the 4-gram distance between a `haystack` string and a `needle` string. For this, it counts the symmetric difference between two multisets of 4-grams and normalizes it by the sum of their cardinalities. Returns a [Float32](../data-types/float.md/#float32-float64) between 0 and 1. The smaller the result is, the more similar the strings are to each other.
Functions [`ngramDistanceCaseInsensitive`](#ngramdistancecaseinsensitive), [`ngramDistanceUTF8`](#ngramdistanceutf8), [`ngramDistanceCaseInsensitiveUTF8`](#ngramdistancecaseinsensitiveutf8) provide case-insensitive and/or UTF-8 variants of this function.
@@ -1022,7 +1020,7 @@ ngramDistance(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the similarity between the two strings. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the similarity between the two strings. [Float32](../data-types/float.md/#float32-float64)
**Implementation details**
@@ -1076,7 +1074,7 @@ ngramDistanceCaseInsensitive(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the similarity between the two strings. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the similarity between the two strings. [Float32](../data-types/float.md/#float32-float64)
**Examples**
@@ -1125,7 +1123,7 @@ ngramDistanceUTF8(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the similarity between the two strings. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the similarity between the two strings. [Float32](../data-types/float.md/#float32-float64)
**Example**
@@ -1158,7 +1156,7 @@ ngramDistanceCaseInsensitiveUTF8(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the similarity between the two strings. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the similarity between the two strings. [Float32](../data-types/float.md/#float32-float64)
**Example**
@@ -1176,7 +1174,7 @@ Result:
## ngramSearch
-Like `ngramDistance` but calculates the non-symmetric difference between a `needle` string and a `haystack` string, i.e. the number of n-grams from the needle minus the common number of n-grams normalized by the number of `needle` n-grams. Returns a [Float32](../../sql-reference/data-types/float.md/#float32-float64) between 0 and 1. The bigger the result is, the more likely `needle` is in the `haystack`. This function is useful for fuzzy string search. Also see function [`soundex`](../../sql-reference/functions/string-functions#soundex).
+Like `ngramDistance` but calculates the non-symmetric difference between a `needle` string and a `haystack` string, i.e. the number of n-grams from the needle minus the common number of n-grams normalized by the number of `needle` n-grams. Returns a [Float32](../data-types/float.md/#float32-float64) between 0 and 1. The bigger the result is, the more likely `needle` is in the `haystack`. This function is useful for fuzzy string search. Also see function [`soundex`](../../sql-reference/functions/string-functions#soundex).
Functions [`ngramSearchCaseInsensitive`](#ngramsearchcaseinsensitive), [`ngramSearchUTF8`](#ngramsearchutf8), [`ngramSearchCaseInsensitiveUTF8`](#ngramsearchcaseinsensitiveutf8) provide case-insensitive and/or UTF-8 variants of this function.
@@ -1193,7 +1191,7 @@ ngramSearch(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../data-types/float.md/#float32-float64)
**Implementation details**
@@ -1232,7 +1230,7 @@ ngramSearchCaseInsensitive(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../data-types/float.md/#float32-float64)
The bigger the result is, the more likely `needle` is in the `haystack`.
@@ -1267,7 +1265,7 @@ ngramSearchUTF8(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../data-types/float.md/#float32-float64)
The bigger the result is, the more likely `needle` is in the `haystack`.
@@ -1302,7 +1300,7 @@ ngramSearchCaseInsensitiveUTF8(haystack, needle)
**Returned value**
-- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../../sql-reference/data-types/float.md/#float32-float64)
+- Value between 0 and 1 representing the likelihood of the `needle` being in the `haystack`. [Float32](../data-types/float.md/#float32-float64)
The bigger the result is, the more likely `needle` is in the `haystack`.
@@ -1336,13 +1334,11 @@ countSubstrings(haystack, needle[, start_pos])
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../../sql-reference/data-types/int-uint.md). Optional.
+- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../data-types/int-uint.md). Optional.
-**Returned values**
+**Returned value**
-- The number of occurrences.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The number of occurrences. [UInt64](../data-types/int-uint.md).
**Examples**
@@ -1385,13 +1381,11 @@ countSubstringsCaseInsensitive(haystack, needle[, start_pos])
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../../sql-reference/data-types/int-uint.md). Optional.
+- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../data-types/int-uint.md). Optional.
-**Returned values**
+**Returned value**
-- The number of occurrences.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The number of occurrences. [UInt64](../data-types/int-uint.md).
**Examples**
@@ -1439,13 +1433,11 @@ countSubstringsCaseInsensitiveUTF8(haystack, needle[, start_pos])
- `haystack` — UTF-8 string in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Substring to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../../sql-reference/data-types/int-uint.md). Optional.
+- `start_pos` – Position (1-based) in `haystack` at which the search starts. [UInt](../data-types/int-uint.md). Optional.
-**Returned values**
+**Returned value**
-- The number of occurrences.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The number of occurrences. [UInt64](../data-types/int-uint.md).
**Examples**
@@ -1492,13 +1484,11 @@ countMatches(haystack, pattern)
**Arguments**
- `haystack` — The string to search in. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `pattern` — The regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). [String](../../sql-reference/data-types/string.md).
+- `pattern` — The regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). [String](../data-types/string.md).
**Returned value**
-- The number of matches.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The number of matches. [UInt64](../data-types/int-uint.md).
**Examples**
@@ -1539,13 +1529,11 @@ countMatchesCaseInsensitive(haystack, pattern)
**Arguments**
- `haystack` — The string to search in. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `pattern` — The regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). [String](../../sql-reference/data-types/string.md).
+- `pattern` — The regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). [String](../data-types/string.md).
**Returned value**
-- The number of matches.
-
-Type: [UInt64](../../sql-reference/data-types/int-uint.md).
+- The number of matches. [UInt64](../data-types/int-uint.md).
**Examples**
@@ -1579,13 +1567,11 @@ Alias: `REGEXP_EXTRACT(haystack, pattern[, index])`.
- `haystack` — String, in which regexp pattern will to be matched. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `pattern` — String, regexp expression, must be constant. [String](../../sql-reference/syntax.md#syntax-string-literal).
-- `index` – An integer number greater or equal 0 with default 1. It represents which regex group to extract. [UInt or Int](../../sql-reference/data-types/int-uint.md). Optional.
+- `index` – An integer number greater or equal 0 with default 1. It represents which regex group to extract. [UInt or Int](../data-types/int-uint.md). Optional.
-**Returned values**
+**Returned value**
-`pattern` may contain multiple regexp groups, `index` indicates which regex group to extract. An index of 0 means matching the entire regular expression.
-
-Type: `String`.
+`pattern` may contain multiple regexp groups, `index` indicates which regex group to extract. An index of 0 means matching the entire regular expression. [String](../data-types/string.md).
**Examples**
@@ -1622,12 +1608,9 @@ hasSubsequence(haystack, needle)
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Subsequence to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-**Returned values**
+**Returned value**
-- 1, if needle is a subsequence of haystack.
-- 0, otherwise.
-
-Type: `UInt8`.
+- 1, if needle is a subsequence of haystack, 0 otherwise. [UInt8](../data-types/int-uint.md).
**Examples**
@@ -1660,12 +1643,9 @@ hasSubsequenceCaseInsensitive(haystack, needle)
- `haystack` — String in which the search is performed. [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Subsequence to be searched. [String](../../sql-reference/syntax.md#syntax-string-literal).
-**Returned values**
+**Returned value**
-- 1, if needle is a subsequence of haystack.
-- 0, otherwise.
-
-Type: `UInt8`.
+- 1, if needle is a subsequence of haystack, 0 otherwise [UInt8](../data-types/int-uint.md).
**Examples**
@@ -1698,12 +1678,9 @@ hasSubsequenceUTF8(haystack, needle)
- `haystack` — String in which the search is performed. UTF-8 encoded [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Subsequence to be searched. UTF-8 encoded [String](../../sql-reference/syntax.md#syntax-string-literal).
-**Returned values**
+**Returned value**
-- 1, if needle is a subsequence of haystack.
-- 0, otherwise.
-
-Type: `UInt8`.
+- 1, if needle is a subsequence of haystack, 0, otherwise. [UInt8](../data-types/int-uint.md).
Query:
@@ -1736,12 +1713,9 @@ hasSubsequenceCaseInsensitiveUTF8(haystack, needle)
- `haystack` — String in which the search is performed. UTF-8 encoded [String](../../sql-reference/syntax.md#syntax-string-literal).
- `needle` — Subsequence to be searched. UTF-8 encoded [String](../../sql-reference/syntax.md#syntax-string-literal).
-**Returned values**
+**Returned value**
-- 1, if needle is a subsequence of haystack.
-- 0, otherwise.
-
-Type: `UInt8`.
+- 1, if needle is a subsequence of haystack, 0 otherwise. [UInt8](../data-types/int-uint.md).
**Examples**
@@ -1776,8 +1750,7 @@ hasToken(haystack, token)
**Returned value**
-- 1, if the token is present in the haystack.
-- 0, if the token is not present.
+- 1, if the token is present in the haystack, 0 otherwise. [UInt8](../data-types/int-uint.md).
**Implementation details**
@@ -1812,9 +1785,7 @@ hasTokenOrNull(haystack, token)
**Returned value**
-- 1, if the token is present in the haystack.
-- 0, if the token is not present in the haystack.
-- null, if the token is ill-formed.
+- 1, if the token is present in the haystack, 0 if it is not present, and null if the token is ill formed.
**Implementation details**
@@ -1851,8 +1822,7 @@ hasTokenCaseInsensitive(haystack, token)
**Returned value**
-- 1, if the token is present in the haystack.
-- 0, otherwise.
+- 1, if the token is present in the haystack, 0 otherwise. [UInt8](../data-types/int-uint.md).
**Implementation details**
@@ -1887,9 +1857,7 @@ hasTokenCaseInsensitiveOrNull(haystack, token)
**Returned value**
-- 1, if the token is present in the haystack.
-- 0, if token is not present.
-- null, if the token is ill-formed.
+- 1, if the token is present in the haystack, 0 if the token is not present, otherwise [`null`](../data-types/nullable.md) if the token is ill-formed. [UInt8](../data-types/int-uint.md).
**Implementation details**
diff --git a/docs/en/sql-reference/functions/time-series-functions.md b/docs/en/sql-reference/functions/time-series-functions.md
index e80a3fa9860..ce5dea14ec5 100644
--- a/docs/en/sql-reference/functions/time-series-functions.md
+++ b/docs/en/sql-reference/functions/time-series-functions.md
@@ -30,9 +30,7 @@ At least four data points are required in `series` to detect outliers.
**Returned value**
-- Returns an array of the same length as the input array where each value represents score of possible anomaly of corresponding element in the series. A non-zero score indicates a possible anomaly.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- Returns an array of the same length as the input array where each value represents score of possible anomaly of corresponding element in the series. A non-zero score indicates a possible anomaly. [Array](../data-types/array.md).
**Examples**
@@ -81,10 +79,7 @@ seriesPeriodDetectFFT(series);
**Returned value**
-- A real value equal to the period of series data
-- Returns NAN when number of data points are less than four.
-
-Type: [Float64](../../sql-reference/data-types/float.md).
+- A real value equal to the period of series data. NaN when number of data points are less than four. [Float64](../data-types/float.md).
**Examples**
@@ -134,9 +129,7 @@ The number of data points in `series` should be at least twice the value of `per
**Returned value**
- An array of four arrays where the first array include seasonal components, the second array - trend,
-the third array - residue component, and the fourth array - baseline(seasonal + trend) component.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+the third array - residue component, and the fourth array - baseline(seasonal + trend) component. [Array](../data-types/array.md).
**Examples**
diff --git a/docs/en/sql-reference/functions/time-window-functions.md b/docs/en/sql-reference/functions/time-window-functions.md
index d8f23c92e61..2cec1987c20 100644
--- a/docs/en/sql-reference/functions/time-window-functions.md
+++ b/docs/en/sql-reference/functions/time-window-functions.md
@@ -17,15 +17,13 @@ tumble(time_attr, interval [, timezone])
```
**Arguments**
-- `time_attr` - Date and time. [DateTime](../../sql-reference/data-types/datetime.md) data type.
-- `interval` - Window interval in [Interval](../../sql-reference/data-types/special-data-types/interval.md) data type.
+- `time_attr` - Date and time. [DateTime](../data-types/datetime.md) data type.
+- `interval` - Window interval in [Interval](../data-types/special-data-types/interval.md) data type.
- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional).
**Returned values**
-- The inclusive lower and exclusive upper bound of the corresponding tumbling window.
-
-Type: `Tuple(DateTime, DateTime)`
+- The inclusive lower and exclusive upper bound of the corresponding tumbling window. [Tuple](../data-types/tuple.md)([DateTime](../data-types/datetime.md), [DateTime](../data-types/datetime.md))`.
**Example**
@@ -53,16 +51,14 @@ hop(time_attr, hop_interval, window_interval [, timezone])
**Arguments**
-- `time_attr` - Date and time. [DateTime](../../sql-reference/data-types/datetime.md) data type.
-- `hop_interval` - Hop interval in [Interval](../../sql-reference/data-types/special-data-types/interval.md) data type. Should be a positive number.
-- `window_interval` - Window interval in [Interval](../../sql-reference/data-types/special-data-types/interval.md) data type. Should be a positive number.
+- `time_attr` - Date and time. [DateTime](../data-types/datetime.md) data type.
+- `hop_interval` - Hop interval in [Interval](../data-types/special-data-types/interval.md) data type. Should be a positive number.
+- `window_interval` - Window interval in [Interval](../data-types/special-data-types/interval.md) data type. Should be a positive number.
- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) (optional).
**Returned values**
-- The inclusive lower and exclusive upper bound of the corresponding hopping window. Since one record can be assigned to multiple hop windows, the function only returns the bound of the **first** window when hop function is used **without** `WINDOW VIEW`.
-
-Type: `Tuple(DateTime, DateTime)`
+- The inclusive lower and exclusive upper bound of the corresponding hopping window. Since one record can be assigned to multiple hop windows, the function only returns the bound of the **first** window when hop function is used **without** `WINDOW VIEW`. [Tuple](../data-types/tuple.md)([DateTime](../data-types/datetime.md), [DateTime](../data-types/datetime.md))`.
**Example**
diff --git a/docs/en/sql-reference/functions/tuple-functions.md b/docs/en/sql-reference/functions/tuple-functions.md
index 64b1732597f..0663be08240 100644
--- a/docs/en/sql-reference/functions/tuple-functions.md
+++ b/docs/en/sql-reference/functions/tuple-functions.md
@@ -7,15 +7,15 @@ sidebar_label: Tuples
## tuple
A function that allows grouping multiple columns.
-For columns with the types T1, T2, …, it returns a Tuple(T1, T2, …) type tuple containing these columns. There is no cost to execute the function.
+For columns with the types T1, T2, ..., it returns a Tuple(T1, T2, ...) type tuple containing these columns. There is no cost to execute the function.
Tuples are normally used as intermediate values for an argument of IN operators, or for creating a list of formal parameters of lambda functions. Tuples can’t be written to a table.
-The function implements the operator `(x, y, …)`.
+The function implements the operator `(x, y, ...)`.
**Syntax**
``` sql
-tuple(x, y, …)
+tuple(x, y, ...)
```
## tupleElement
@@ -35,7 +35,7 @@ tupleElement(tuple, name, [, default_value])
## untuple
-Performs syntactic substitution of [tuple](../../sql-reference/data-types/tuple.md#tuplet1-t2) elements in the call location.
+Performs syntactic substitution of [tuple](../data-types/tuple.md#tuplet1-t2) elements in the call location.
The names of the result columns are implementation-specific and subject to change. Do not assume specific column names after `untuple`.
@@ -49,7 +49,7 @@ You can use the `EXCEPT` expression to skip columns as a result of the query.
**Arguments**
-- `x` — A `tuple` function, column, or tuple of elements. [Tuple](../../sql-reference/data-types/tuple.md).
+- `x` — A `tuple` function, column, or tuple of elements. [Tuple](../data-types/tuple.md).
**Returned value**
@@ -111,7 +111,7 @@ Result:
**See Also**
-- [Tuple](../../sql-reference/data-types/tuple.md)
+- [Tuple](../data-types/tuple.md)
## tupleHammingDistance
@@ -125,8 +125,8 @@ tupleHammingDistance(tuple1, tuple2)
**Arguments**
-- `tuple1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md).
-- `tuple2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple1` — First tuple. [Tuple](../data-types/tuple.md).
+- `tuple2` — Second tuple. [Tuple](../data-types/tuple.md).
Tuples should have the same type of the elements.
@@ -134,7 +134,9 @@ Tuples should have the same type of the elements.
- The Hamming distance.
-Type: The result type is calculated the same way it is for [Arithmetic functions](../../sql-reference/functions/arithmetic-functions.md), based on the number of elements in the input tuples.
+:::note
+The result type is calculated the same way it is for [Arithmetic functions](../../sql-reference/functions/arithmetic-functions.md), based on the number of elements in the input tuples.
+:::
``` sql
SELECT
@@ -196,13 +198,11 @@ tupleToNameValuePairs(tuple)
**Arguments**
-- `tuple` — Named tuple. [Tuple](../../sql-reference/data-types/tuple.md) with any types of values.
+- `tuple` — Named tuple. [Tuple](../data-types/tuple.md) with any types of values.
**Returned value**
-- An array with (name, value) pairs.
-
-Type: [Array](../../sql-reference/data-types/array.md)([Tuple](../../sql-reference/data-types/tuple.md)([String](../../sql-reference/data-types/string.md), ...)).
+- An array with (name, value) pairs. [Array](../data-types/array.md)([Tuple](../data-types/tuple.md)([String](../data-types/string.md), ...)).
**Example**
@@ -273,14 +273,12 @@ Alias: `vectorSum`.
**Arguments**
-- `tuple1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md).
-- `tuple2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple1` — First tuple. [Tuple](../data-types/tuple.md).
+- `tuple2` — Second tuple. [Tuple](../data-types/tuple.md).
**Returned value**
-- Tuple with the sum.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with the sum. [Tuple](../data-types/tuple.md).
**Example**
@@ -312,14 +310,12 @@ Alias: `vectorDifference`.
**Arguments**
-- `tuple1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md).
-- `tuple2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple1` — First tuple. [Tuple](../data-types/tuple.md).
+- `tuple2` — Second tuple. [Tuple](../data-types/tuple.md).
**Returned value**
-- Tuple with the result of subtraction.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with the result of subtraction. [Tuple](../data-types/tuple.md).
**Example**
@@ -349,14 +345,12 @@ tupleMultiply(tuple1, tuple2)
**Arguments**
-- `tuple1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md).
-- `tuple2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple1` — First tuple. [Tuple](../data-types/tuple.md).
+- `tuple2` — Second tuple. [Tuple](../data-types/tuple.md).
**Returned value**
-- Tuple with the multiplication.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with the multiplication. [Tuple](../data-types/tuple.md).
**Example**
@@ -386,14 +380,12 @@ tupleDivide(tuple1, tuple2)
**Arguments**
-- `tuple1` — First tuple. [Tuple](../../sql-reference/data-types/tuple.md).
-- `tuple2` — Second tuple. [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple1` — First tuple. [Tuple](../data-types/tuple.md).
+- `tuple2` — Second tuple. [Tuple](../data-types/tuple.md).
**Returned value**
-- Tuple with the result of division.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with the result of division. [Tuple](../data-types/tuple.md).
**Example**
@@ -423,13 +415,11 @@ tupleNegate(tuple)
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
**Returned value**
-- Tuple with the result of negation.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with the result of negation. [Tuple](../data-types/tuple.md).
**Example**
@@ -459,14 +449,12 @@ tupleMultiplyByNumber(tuple, number)
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
-- `number` — Multiplier. [Int/UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
+- `number` — Multiplier. [Int/UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
**Returned value**
-- Tuple with multiplied values.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with multiplied values. [Tuple](../data-types/tuple.md).
**Example**
@@ -496,14 +484,12 @@ tupleDivideByNumber(tuple, number)
**Arguments**
-- `tuple` — [Tuple](../../sql-reference/data-types/tuple.md).
-- `number` — Divider. [Int/UInt](../../sql-reference/data-types/int-uint.md), [Float](../../sql-reference/data-types/float.md) or [Decimal](../../sql-reference/data-types/decimal.md).
+- `tuple` — [Tuple](../data-types/tuple.md).
+- `number` — Divider. [Int/UInt](../data-types/int-uint.md), [Float](../data-types/float.md) or [Decimal](../data-types/decimal.md).
**Returned value**
-- Tuple with divided values.
-
-Type: [Tuple](../../sql-reference/data-types/tuple.md).
+- Tuple with divided values. [Tuple](../data-types/tuple.md).
**Example**
@@ -531,7 +517,7 @@ tupleConcat(tuples)
**Arguments**
-- `tuples` – Arbitrary number of arguments of [Tuple](../../sql-reference/data-types/tuple.md) type.
+- `tuples` – Arbitrary number of arguments of [Tuple](../data-types/tuple.md) type.
**Example**
diff --git a/docs/en/sql-reference/functions/tuple-map-functions.md b/docs/en/sql-reference/functions/tuple-map-functions.md
index 377283bc006..d9c18e2a0a2 100644
--- a/docs/en/sql-reference/functions/tuple-map-functions.md
+++ b/docs/en/sql-reference/functions/tuple-map-functions.md
@@ -6,7 +6,7 @@ sidebar_label: Maps
## map
-Arranges `key:value` pairs into [Map(key, value)](../../sql-reference/data-types/map.md) data type.
+Arranges `key:value` pairs into [Map(key, value)](../data-types/map.md) data type.
**Syntax**
@@ -16,14 +16,12 @@ map(key1, value1[, key2, value2, ...])
**Arguments**
-- `key` — The key part of the pair. Arbitrary type, except [Nullable](../../sql-reference/data-types/nullable.md) and [LowCardinality](../../sql-reference/data-types/lowcardinality.md) nested with [Nullable](../../sql-reference/data-types/nullable.md).
-- `value` — The value part of the pair. Arbitrary type, including [Map](../../sql-reference/data-types/map.md) and [Array](../../sql-reference/data-types/array.md).
+- `key` — The key part of the pair. Arbitrary type, except [Nullable](../data-types/nullable.md) and [LowCardinality](../data-types/lowcardinality.md) nested with [Nullable](../data-types/nullable.md).
+- `value` — The value part of the pair. Arbitrary type, including [Map](../data-types/map.md) and [Array](../data-types/array.md).
**Returned value**
-- Data structure as `key:value` pairs.
-
-Type: [Map(key, value)](../../sql-reference/data-types/map.md).
+- Data structure as `key:value` pairs. [Map(key, value)](../data-types/map.md).
**Examples**
@@ -63,11 +61,11 @@ Result:
**See Also**
-- [Map(key, value)](../../sql-reference/data-types/map.md) data type
+- [Map(key, value)](../data-types/map.md) data type
## mapFromArrays
-Merges an [Array](../../sql-reference/data-types/array.md) of keys and an [Array](../../sql-reference/data-types/array.md) of values into a [Map(key, value)](../../sql-reference/data-types/map.md). Notice that the second argument could also be a [Map](../../sql-reference/data-types/map.md), thus it is casted to an Array when executing.
+Merges an [Array](../data-types/array.md) of keys and an [Array](../data-types/array.md) of values into a [Map(key, value)](../data-types/map.md). Notice that the second argument could also be a [Map](../data-types/map.md), thus it is casted to an Array when executing.
The function is a more convenient alternative to `CAST((key_array, value_array_or_map), 'Map(key_type, value_type)')`. For example, instead of writing `CAST((['aa', 'bb'], [4, 5]), 'Map(String, UInt32)')`, you can write `mapFromArrays(['aa', 'bb'], [4, 5])`.
@@ -83,7 +81,7 @@ Alias: `MAP_FROM_ARRAYS(keys, values)`
**Arguments**
-- `keys` — Given key array to create a map from. The nested type of array must be: [String](../../sql-reference/data-types/string.md), [Integer](../../sql-reference/data-types/int-uint.md), [LowCardinality](../../sql-reference/data-types/lowcardinality.md), [FixedString](../../sql-reference/data-types/fixedstring.md), [UUID](../../sql-reference/data-types/uuid.md), [Date](../../sql-reference/data-types/date.md), [DateTime](../../sql-reference/data-types/datetime.md), [Date32](../../sql-reference/data-types/date32.md), [Enum](../../sql-reference/data-types/enum.md)
+- `keys` — Given key array to create a map from. The nested type of array must be: [String](../data-types/string.md), [Integer](../data-types/int-uint.md), [LowCardinality](../data-types/lowcardinality.md), [FixedString](../data-types/fixedstring.md), [UUID](../data-types/uuid.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [Date32](../data-types/date32.md), [Enum](../data-types/enum.md)
- `values` - Given value array or map to create a map from.
**Returned value**
@@ -111,7 +109,7 @@ SELECT mapFromArrays([1, 2, 3], map('a', 1, 'b', 2, 'c', 3))
## extractKeyValuePairs
-Extracts key-value pairs, i.e. a [Map(String, String)](../../sql-reference/data-types/map.md), from a string. Parsing is robust towards noise (e.g. log files).
+Extracts key-value pairs, i.e. a [Map(String, String)](../data-types/map.md), from a string. Parsing is robust towards noise (e.g. log files).
A key-value pair consists of a key, followed by a `key_value_delimiter` and a value. Key value pairs must be separated by `pair_delimiter`. Quoted keys and values are also supported.
@@ -127,14 +125,14 @@ Alias:
**Arguments**
-- `data` - String to extract key-value pairs from. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `key_value_delimiter` - Character to be used as delimiter between the key and the value. Defaults to `:`. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `pair_delimiters` - Set of character to be used as delimiters between pairs. Defaults to ` `, `,` and `;`. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
-- `quoting_character` - Character to be used as quoting character. Defaults to `"`. [String](../../sql-reference/data-types/string.md) or [FixedString](../../sql-reference/data-types/fixedstring.md).
+- `data` - String to extract key-value pairs from. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `key_value_delimiter` - Character to be used as delimiter between the key and the value. Defaults to `:`. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `pair_delimiters` - Set of character to be used as delimiters between pairs. Defaults to ` `, `,` and `;`. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+- `quoting_character` - Character to be used as quoting character. Defaults to `"`. [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
**Returned values**
-- A [Map(String, String)](../../sql-reference/data-types/map.md) of key-value pairs.
+- A [Map(String, String)](../data-types/map.md) of key-value pairs.
**Examples**
@@ -223,11 +221,11 @@ mapAdd(arg1, arg2 [, ...])
**Arguments**
-Arguments are [maps](../../sql-reference/data-types/map.md) or [tuples](../../sql-reference/data-types/tuple.md#tuplet1-t2) of two [arrays](../../sql-reference/data-types/array.md#data-type-array), where items in the first array represent keys, and the second array contains values for the each key. All key arrays should have same type, and all value arrays should contain items which are promoted to the one type ([Int64](../../sql-reference/data-types/int-uint.md#int-ranges), [UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges) or [Float64](../../sql-reference/data-types/float.md#float32-float64)). The common promoted type is used as a type for the result array.
+Arguments are [maps](../data-types/map.md) or [tuples](../data-types/tuple.md#tuplet1-t2) of two [arrays](../data-types/array.md#data-type-array), where items in the first array represent keys, and the second array contains values for the each key. All key arrays should have same type, and all value arrays should contain items which are promoted to the one type ([Int64](../data-types/int-uint.md#int-ranges), [UInt64](../data-types/int-uint.md#uint-ranges) or [Float64](../data-types/float.md#float32-float64)). The common promoted type is used as a type for the result array.
**Returned value**
-- Depending on the arguments returns one [map](../../sql-reference/data-types/map.md) or [tuple](../../sql-reference/data-types/tuple.md#tuplet1-t2), where the first array contains the sorted keys and the second array contains values.
+- Depending on the arguments returns one [map](../data-types/map.md) or [tuple](../data-types/tuple.md#tuplet1-t2), where the first array contains the sorted keys and the second array contains values.
**Example**
@@ -271,11 +269,11 @@ mapSubtract(Tuple(Array, Array), Tuple(Array, Array) [, ...])
**Arguments**
-Arguments are [maps](../../sql-reference/data-types/map.md) or [tuples](../../sql-reference/data-types/tuple.md#tuplet1-t2) of two [arrays](../../sql-reference/data-types/array.md#data-type-array), where items in the first array represent keys, and the second array contains values for the each key. All key arrays should have same type, and all value arrays should contain items which are promote to the one type ([Int64](../../sql-reference/data-types/int-uint.md#int-ranges), [UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges) or [Float64](../../sql-reference/data-types/float.md#float32-float64)). The common promoted type is used as a type for the result array.
+Arguments are [maps](../data-types/map.md) or [tuples](../data-types/tuple.md#tuplet1-t2) of two [arrays](../data-types/array.md#data-type-array), where items in the first array represent keys, and the second array contains values for the each key. All key arrays should have same type, and all value arrays should contain items which are promote to the one type ([Int64](../data-types/int-uint.md#int-ranges), [UInt64](../data-types/int-uint.md#uint-ranges) or [Float64](../data-types/float.md#float32-float64)). The common promoted type is used as a type for the result array.
**Returned value**
-- Depending on the arguments returns one [map](../../sql-reference/data-types/map.md) or [tuple](../../sql-reference/data-types/tuple.md#tuplet1-t2), where the first array contains the sorted keys and the second array contains values.
+- Depending on the arguments returns one [map](../data-types/map.md) or [tuple](../data-types/tuple.md#tuplet1-t2), where the first array contains the sorted keys and the second array contains values.
**Example**
@@ -324,21 +322,21 @@ For array arguments the number of elements in `keys` and `values` must be the sa
**Arguments**
-Arguments are [maps](../../sql-reference/data-types/map.md) or two [arrays](../../sql-reference/data-types/array.md#data-type-array), where the first array represent keys, and the second array contains values for the each key.
+Arguments are [maps](../data-types/map.md) or two [arrays](../data-types/array.md#data-type-array), where the first array represent keys, and the second array contains values for the each key.
Mapped arrays:
-- `keys` — Array of keys. [Array](../../sql-reference/data-types/array.md#data-type-array)([Int](../../sql-reference/data-types/int-uint.md#uint-ranges)).
-- `values` — Array of values. [Array](../../sql-reference/data-types/array.md#data-type-array)([Int](../../sql-reference/data-types/int-uint.md#uint-ranges)).
-- `max` — Maximum key value. Optional. [Int8, Int16, Int32, Int64, Int128, Int256](../../sql-reference/data-types/int-uint.md#int-ranges).
+- `keys` — Array of keys. [Array](../data-types/array.md#data-type-array)([Int](../data-types/int-uint.md#uint-ranges)).
+- `values` — Array of values. [Array](../data-types/array.md#data-type-array)([Int](../data-types/int-uint.md#uint-ranges)).
+- `max` — Maximum key value. Optional. [Int8, Int16, Int32, Int64, Int128, Int256](../data-types/int-uint.md#int-ranges).
or
-- `map` — Map with integer keys. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map with integer keys. [Map](../data-types/map.md).
**Returned value**
-- Depending on the arguments returns a [map](../../sql-reference/data-types/map.md) or a [tuple](../../sql-reference/data-types/tuple.md#tuplet1-t2) of two [arrays](../../sql-reference/data-types/array.md#data-type-array): keys in sorted order, and values the corresponding keys.
+- Depending on the arguments returns a [map](../data-types/map.md) or a [tuple](../data-types/tuple.md#tuplet1-t2) of two [arrays](../data-types/array.md#data-type-array): keys in sorted order, and values the corresponding keys.
**Example**
@@ -382,14 +380,12 @@ mapContains(map, key)
**Arguments**
-- `map` — Map. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map. [Map](../data-types/map.md).
- `key` — Key. Type matches the type of keys of `map` parameter.
**Returned value**
-- `1` if `map` contains `key`, `0` if not.
-
-Type: [UInt8](../../sql-reference/data-types/int-uint.md).
+- `1` if `map` contains `key`, `0` if not. [UInt8](../data-types/int-uint.md).
**Example**
@@ -417,7 +413,7 @@ Result:
Returns all keys from the `map` parameter.
-Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [keys](../../sql-reference/data-types/map.md#map-subcolumns) subcolumn instead of reading and processing the whole column data. The query `SELECT mapKeys(m) FROM table` transforms to `SELECT m.keys FROM table`.
+Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [keys](../data-types/map.md#map-subcolumns) subcolumn instead of reading and processing the whole column data. The query `SELECT mapKeys(m) FROM table` transforms to `SELECT m.keys FROM table`.
**Syntax**
@@ -427,13 +423,11 @@ mapKeys(map)
**Arguments**
-- `map` — Map. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map. [Map](../data-types/map.md).
**Returned value**
-- Array containing all keys from the `map`.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- Array containing all keys from the `map`. [Array](../data-types/array.md).
**Example**
@@ -460,7 +454,7 @@ Result:
Returns all values from the `map` parameter.
-Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [values](../../sql-reference/data-types/map.md#map-subcolumns) subcolumn instead of reading and processing the whole column data. The query `SELECT mapValues(m) FROM table` transforms to `SELECT m.values FROM table`.
+Can be optimized by enabling the [optimize_functions_to_subcolumns](../../operations/settings/settings.md#optimize-functions-to-subcolumns) setting. With `optimize_functions_to_subcolumns = 1` the function reads only [values](../data-types/map.md#map-subcolumns) subcolumn instead of reading and processing the whole column data. The query `SELECT mapValues(m) FROM table` transforms to `SELECT m.values FROM table`.
**Syntax**
@@ -470,13 +464,11 @@ mapValues(map)
**Arguments**
-- `map` — Map. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map. [Map](../data-types/map.md).
**Returned value**
-- Array containing all the values from `map`.
-
-Type: [Array](../../sql-reference/data-types/array.md).
+- Array containing all the values from `map`. [Array](../data-types/array.md).
**Example**
@@ -508,7 +500,7 @@ mapContainsKeyLike(map, pattern)
```
**Arguments**
-- `map` — Map. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map. [Map](../data-types/map.md).
- `pattern` - String pattern to match.
**Returned value**
@@ -546,7 +538,7 @@ mapExtractKeyLike(map, pattern)
**Arguments**
-- `map` — Map. [Map](../../sql-reference/data-types/map.md).
+- `map` — Map. [Map](../data-types/map.md).
- `pattern` - String pattern to match.
**Returned value**
@@ -585,11 +577,11 @@ mapApply(func, map)
**Arguments**
- `func` - [Lambda function](../../sql-reference/functions/index.md#higher-order-functions---operator-and-lambdaparams-expr-function).
-- `map` — [Map](../../sql-reference/data-types/map.md).
+- `map` — [Map](../data-types/map.md).
**Returned value**
-- Returns a map obtained from the original map by application of `func(map1[i], …, mapN[i])` for each element.
+- Returns a map obtained from the original map by application of `func(map1[i], ..., mapN[i])` for each element.
**Example**
@@ -625,11 +617,11 @@ mapFilter(func, map)
**Arguments**
- `func` - [Lambda function](../../sql-reference/functions/index.md#higher-order-functions---operator-and-lambdaparams-expr-function).
-- `map` — [Map](../../sql-reference/data-types/map.md).
+- `map` — [Map](../data-types/map.md).
**Returned value**
-- Returns a map containing only the elements in `map` for which `func(map1[i], …, mapN[i])` returns something other than 0.
+- Returns a map containing only the elements in `map` for which `func(map1[i], ..., mapN[i])` returns something other than 0.
**Example**
@@ -666,8 +658,8 @@ mapUpdate(map1, map2)
**Arguments**
-- `map1` [Map](../../sql-reference/data-types/map.md).
-- `map2` [Map](../../sql-reference/data-types/map.md).
+- `map1` [Map](../data-types/map.md).
+- `map2` [Map](../data-types/map.md).
**Returned value**
@@ -699,7 +691,7 @@ mapConcat(maps)
**Arguments**
-- `maps` – Arbitrary number of arguments of [Map](../../sql-reference/data-types/map.md) type.
+- `maps` – Arbitrary number of arguments of [Map](../data-types/map.md) type.
**Returned value**
diff --git a/docs/en/sql-reference/functions/type-conversion-functions.md b/docs/en/sql-reference/functions/type-conversion-functions.md
index ea08ffa50e7..5dd1d5ceebe 100644
--- a/docs/en/sql-reference/functions/type-conversion-functions.md
+++ b/docs/en/sql-reference/functions/type-conversion-functions.md
@@ -51,7 +51,7 @@ SETTINGS cast_keep_nullable = 1
## toInt(8\|16\|32\|64\|128\|256)
-Converts an input value to a value the [Int](/docs/en/sql-reference/data-types/int-uint.md) data type. This function family includes:
+Converts an input value to a value the [Int](../data-types/int-uint.md) data type. This function family includes:
- `toInt8(expr)` — Converts to a value of data type `Int8`.
- `toInt16(expr)` — Converts to a value of data type `Int16`.
@@ -62,7 +62,7 @@ Converts an input value to a value the [Int](/docs/en/sql-reference/data-types/i
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions) returning a number or a string with the decimal representation of a number. Binary, octal, and hexadecimal representations of numbers are not supported. Leading zeroes are stripped.
+- `expr` — [Expression](../syntax.md/#syntax-expressions) returning a number or a string with the decimal representation of a number. Binary, octal, and hexadecimal representations of numbers are not supported. Leading zeroes are stripped.
**Returned value**
@@ -70,7 +70,7 @@ Integer value in the `Int8`, `Int16`, `Int32`, `Int64`, `Int128` or `Int256` dat
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
-The behavior of functions for the [NaN and Inf](/docs/en/sql-reference/data-types/float.md/#data_type-float-nan-inf) arguments is undefined. Remember about [numeric conversions issues](#numeric-conversion-issues), when using the functions.
+The behavior of functions for the [NaN and Inf](../data-types/float.md/#data_type-float-nan-inf) arguments is undefined. Remember about [numeric conversions issues](#numeric-conversion-issues), when using the functions.
**Example**
@@ -90,7 +90,7 @@ Result:
## toInt(8\|16\|32\|64\|128\|256)OrZero
-Takes an argument of type [String](/docs/en/sql-reference/data-types/string.md) and tries to parse it into an Int (8 \| 16 \| 32 \| 64 \| 128 \| 256). If unsuccessful, returns `0`.
+Takes an argument of type [String](../data-types/string.md) and tries to parse it into an Int (8 \| 16 \| 32 \| 64 \| 128 \| 256). If unsuccessful, returns `0`.
**Example**
@@ -151,7 +151,7 @@ Result:
## toUInt(8\|16\|32\|64\|256)
-Converts an input value to the [UInt](/docs/en/sql-reference/data-types/int-uint.md) data type. This function family includes:
+Converts an input value to the [UInt](../data-types/int-uint.md) data type. This function family includes:
- `toUInt8(expr)` — Converts to a value of data type `UInt8`.
- `toUInt16(expr)` — Converts to a value of data type `UInt16`.
@@ -161,7 +161,7 @@ Converts an input value to the [UInt](/docs/en/sql-reference/data-types/int-uint
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions) returning a number or a string with the decimal representation of a number. Binary, octal, and hexadecimal representations of numbers are not supported. Leading zeroes are stripped.
+- `expr` — [Expression](../syntax.md/#syntax-expressions) returning a number or a string with the decimal representation of a number. Binary, octal, and hexadecimal representations of numbers are not supported. Leading zeroes are stripped.
**Returned value**
@@ -169,7 +169,7 @@ Converts an input value to the [UInt](/docs/en/sql-reference/data-types/int-uint
Functions use [rounding towards zero](https://en.wikipedia.org/wiki/Rounding#Rounding_towards_zero), meaning they truncate fractional digits of numbers.
-The behavior of functions for negative arguments and for the [NaN and Inf](/docs/en/sql-reference/data-types/float.md/#data_type-float-nan-inf) arguments is undefined. If you pass a string with a negative number, for example `'-32'`, ClickHouse raises an exception. Remember about [numeric conversions issues](#numeric-conversion-issues), when using the functions.
+The behavior of functions for negative arguments and for the [NaN and Inf](../data-types/float.md/#data_type-float-nan-inf) arguments is undefined. If you pass a string with a negative number, for example `'-32'`, ClickHouse raises an exception. Remember about [numeric conversions issues](#numeric-conversion-issues), when using the functions.
**Example**
@@ -203,9 +203,9 @@ Result:
## toDate
-Converts the argument to [Date](/docs/en/sql-reference/data-types/date.md) data type.
+Converts the argument to [Date](../data-types/date.md) data type.
-If the argument is [DateTime](/docs/en/sql-reference/data-types/datetime.md) or [DateTime64](/docs/en/sql-reference/data-types/datetime64.md), it truncates it and leaves the date component of the DateTime:
+If the argument is [DateTime](../data-types/datetime.md) or [DateTime64](../data-types/datetime64.md), it truncates it and leaves the date component of the DateTime:
```sql
SELECT
@@ -219,7 +219,7 @@ SELECT
└─────────────────────┴───────────────┘
```
-If the argument is a [String](/docs/en/sql-reference/data-types/string.md), it is parsed as [Date](/docs/en/sql-reference/data-types/date.md) or [DateTime](/docs/en/sql-reference/data-types/datetime.md). If it was parsed as [DateTime](/docs/en/sql-reference/data-types/datetime.md), the date component is being used:
+If the argument is a [String](../data-types/string.md), it is parsed as [Date](../data-types/date.md) or [DateTime](../data-types/datetime.md). If it was parsed as [DateTime](../data-types/datetime.md), the date component is being used:
```sql
SELECT
@@ -247,7 +247,7 @@ SELECT
└────────────┴───────────────────────────────────────────┘
```
-If the argument is a number and looks like a UNIX timestamp (is greater than 65535), it is interpreted as a [DateTime](/docs/en/sql-reference/data-types/datetime.md), then truncated to [Date](/docs/en/sql-reference/data-types/date.md) in the current timezone. The timezone argument can be specified as a second argument of the function. The truncation to [Date](/docs/en/sql-reference/data-types/date.md) depends on the timezone:
+If the argument is a number and looks like a UNIX timestamp (is greater than 65535), it is interpreted as a [DateTime](../data-types/datetime.md), then truncated to [Date](../data-types/date.md) in the current timezone. The timezone argument can be specified as a second argument of the function. The truncation to [Date](../data-types/date.md) depends on the timezone:
```sql
SELECT
@@ -276,7 +276,7 @@ date_Samoa_2: 2022-12-31
The example above demonstrates how the same UNIX timestamp can be interpreted as different dates in different time zones.
-If the argument is a number and it is smaller than 65536, it is interpreted as the number of days since 1970-01-01 (the first UNIX day) and converted to [Date](/docs/en/sql-reference/data-types/date.md). It corresponds to the internal numeric representation of the `Date` data type. Example:
+If the argument is a number and it is smaller than 65536, it is interpreted as the number of days since 1970-01-01 (the first UNIX day) and converted to [Date](../data-types/date.md). It corresponds to the internal numeric representation of the `Date` data type. Example:
```sql
SELECT toDate(12345)
@@ -317,7 +317,7 @@ SELECT
## toDateOrZero
-The same as [toDate](#todate) but returns lower boundary of [Date](/docs/en/sql-reference/data-types/date.md) if an invalid argument is received. Only [String](/docs/en/sql-reference/data-types/string.md) argument is supported.
+The same as [toDate](#todate) but returns lower boundary of [Date](../data-types/date.md) if an invalid argument is received. Only [String](../data-types/string.md) argument is supported.
**Example**
@@ -338,7 +338,7 @@ Result:
## toDateOrNull
-The same as [toDate](#todate) but returns `NULL` if an invalid argument is received. Only [String](/docs/en/sql-reference/data-types/string.md) argument is supported.
+The same as [toDate](#todate) but returns `NULL` if an invalid argument is received. Only [String](../data-types/string.md) argument is supported.
**Example**
@@ -359,7 +359,7 @@ Result:
## toDateOrDefault
-Like [toDate](#todate) but if unsuccessful, returns a default value which is either the second argument (if specified), or otherwise the lower boundary of [Date](/docs/en/sql-reference/data-types/date.md).
+Like [toDate](#todate) but if unsuccessful, returns a default value which is either the second argument (if specified), or otherwise the lower boundary of [Date](../data-types/date.md).
**Syntax**
@@ -386,7 +386,7 @@ Result:
## toDateTime
-Converts an input value to [DateTime](/docs/en/sql-reference/data-types/datetime.md).
+Converts an input value to [DateTime](../data-types/datetime.md).
**Syntax**
@@ -396,18 +396,18 @@ toDateTime(expr[, time_zone ])
**Arguments**
-- `expr` — The value. [String](/docs/en/sql-reference/data-types/string.md), [Int](/docs/en/sql-reference/data-types/int-uint.md), [Date](/docs/en/sql-reference/data-types/date.md) or [DateTime](/docs/en/sql-reference/data-types/datetime.md).
-- `time_zone` — Time zone. [String](/docs/en/sql-reference/data-types/string.md).
+- `expr` — The value. [String](../data-types/string.md), [Int](../data-types/int-uint.md), [Date](../data-types/date.md) or [DateTime](../data-types/datetime.md).
+- `time_zone` — Time zone. [String](../data-types/string.md).
:::note
If `expr` is a number, it is interpreted as the number of seconds since the beginning of the Unix Epoch (as Unix timestamp).
-If `expr` is a [String](/docs/en/sql-reference/data-types/string.md), it may be interpreted as a Unix timestamp or as a string representation of date / date with time.
+If `expr` is a [String](../data-types/string.md), it may be interpreted as a Unix timestamp or as a string representation of date / date with time.
Thus, parsing of short numbers' string representations (up to 4 digits) is explicitly disabled due to ambiguity, e.g. a string `'1999'` may be both a year (an incomplete string representation of Date / DateTime) or a unix timestamp. Longer numeric strings are allowed.
:::
**Returned value**
-- A date time. [DateTime](/docs/en/sql-reference/data-types/datetime.md)
+- A date time. [DateTime](../data-types/datetime.md)
**Example**
@@ -428,7 +428,7 @@ Result:
## toDateTimeOrZero
-The same as [toDateTime](#todatetime) but returns lower boundary of [DateTime](/docs/en/sql-reference/data-types/datetime.md) if an invalid argument is received. Only [String](/docs/en/sql-reference/data-types/string.md) argument is supported.
+The same as [toDateTime](#todatetime) but returns lower boundary of [DateTime](../data-types/datetime.md) if an invalid argument is received. Only [String](../data-types/string.md) argument is supported.
**Example**
@@ -449,7 +449,7 @@ Result:
## toDateTimeOrNull
-The same as [toDateTime](#todatetime) but returns `NULL` if an invalid argument is received. Only [String](/docs/en/sql-reference/data-types/string.md) argument is supported.
+The same as [toDateTime](#todatetime) but returns `NULL` if an invalid argument is received. Only [String](../data-types/string.md) argument is supported.
**Example**
@@ -470,7 +470,7 @@ Result:
## toDateTimeOrDefault
-Like [toDateTime](#todatetime) but if unsuccessful, returns a default value which is either the third argument (if specified), or otherwise the lower boundary of [DateTime](/docs/en/sql-reference/data-types/datetime.md).
+Like [toDateTime](#todatetime) but if unsuccessful, returns a default value which is either the third argument (if specified), or otherwise the lower boundary of [DateTime](../data-types/datetime.md).
**Syntax**
@@ -497,7 +497,7 @@ Result:
## toDate32
-Converts the argument to the [Date32](/docs/en/sql-reference/data-types/date32.md) data type. If the value is outside the range, `toDate32` returns the border values supported by [Date32](/docs/en/sql-reference/data-types/date32.md). If the argument has [Date](/docs/en/sql-reference/data-types/date.md) type, it's borders are taken into account.
+Converts the argument to the [Date32](../data-types/date32.md) data type. If the value is outside the range, `toDate32` returns the border values supported by [Date32](../data-types/date32.md). If the argument has [Date](../data-types/date.md) type, it's borders are taken into account.
**Syntax**
@@ -507,11 +507,11 @@ toDate32(expr)
**Arguments**
-- `expr` — The value. [String](/docs/en/sql-reference/data-types/string.md), [UInt32](/docs/en/sql-reference/data-types/int-uint.md) or [Date](/docs/en/sql-reference/data-types/date.md).
+- `expr` — The value. [String](../data-types/string.md), [UInt32](../data-types/int-uint.md) or [Date](../data-types/date.md).
**Returned value**
-- A calendar date. Type [Date32](/docs/en/sql-reference/data-types/date32.md).
+- A calendar date. Type [Date32](../data-types/date32.md).
**Example**
@@ -539,7 +539,7 @@ SELECT toDate32('1899-01-01') AS value, toTypeName(value);
└────────────┴────────────────────────────────────┘
```
-3. With [Date](/docs/en/sql-reference/data-types/date.md) argument:
+3. With [Date](../data-types/date.md) argument:
``` sql
SELECT toDate32(toDate('1899-01-01')) AS value, toTypeName(value);
@@ -553,7 +553,7 @@ SELECT toDate32(toDate('1899-01-01')) AS value, toTypeName(value);
## toDate32OrZero
-The same as [toDate32](#todate32) but returns the min value of [Date32](/docs/en/sql-reference/data-types/date32.md) if an invalid argument is received.
+The same as [toDate32](#todate32) but returns the min value of [Date32](../data-types/date32.md) if an invalid argument is received.
**Example**
@@ -593,7 +593,7 @@ Result:
## toDate32OrDefault
-Converts the argument to the [Date32](/docs/en/sql-reference/data-types/date32.md) data type. If the value is outside the range, `toDate32OrDefault` returns the lower border value supported by [Date32](/docs/en/sql-reference/data-types/date32.md). If the argument has [Date](/docs/en/sql-reference/data-types/date.md) type, it's borders are taken into account. Returns default value if an invalid argument is received.
+Converts the argument to the [Date32](../data-types/date32.md) data type. If the value is outside the range, `toDate32OrDefault` returns the lower border value supported by [Date32](../data-types/date32.md). If the argument has [Date](../data-types/date.md) type, it's borders are taken into account. Returns default value if an invalid argument is received.
**Example**
@@ -615,7 +615,7 @@ Result:
## toDateTime64
-Converts the argument to the [DateTime64](/docs/en/sql-reference/data-types/datetime64.md) data type.
+Converts the argument to the [DateTime64](../data-types/datetime64.md) data type.
**Syntax**
@@ -625,15 +625,13 @@ toDateTime64(expr, scale, [timezone])
**Arguments**
-- `expr` — The value. [String](/docs/en/sql-reference/data-types/string.md), [UInt32](/docs/en/sql-reference/data-types/int-uint.md), [Float](/docs/en/sql-reference/data-types/float.md) or [DateTime](/docs/en/sql-reference/data-types/datetime.md).
+- `expr` — The value. [String](../data-types/string.md), [UInt32](../data-types/int-uint.md), [Float](../data-types/float.md) or [DateTime](../data-types/datetime.md).
- `scale` - Tick size (precision): 10-precision seconds. Valid range: [ 0 : 9 ].
- `timezone` - Time zone of the specified datetime64 object.
**Returned value**
-- A calendar date and time of day, with sub-second precision.
-
-Type: [DateTime64](/docs/en/sql-reference/data-types/datetime64.md).
+- A calendar date and time of day, with sub-second precision. [DateTime64](../data-types/datetime64.md).
**Example**
@@ -694,7 +692,7 @@ SELECT toDateTime64('2019-01-01 00:00:00', 3, 'Asia/Istanbul') AS value, toTypeN
## toDecimal(32\|64\|128\|256)
-Converts `value` to the [Decimal](/docs/en/sql-reference/data-types/decimal.md) data type with precision of `S`. The `value` can be a number or a string. The `S` (scale) parameter specifies the number of decimal places.
+Converts `value` to the [Decimal](../data-types/decimal.md) data type with precision of `S`. The `value` can be a number or a string. The `S` (scale) parameter specifies the number of decimal places.
- `toDecimal32(value, S)`
- `toDecimal64(value, S)`
@@ -703,7 +701,7 @@ Converts `value` to the [Decimal](/docs/en/sql-reference/data-types/decimal.md)
## toDecimal(32\|64\|128\|256)OrNull
-Converts an input string to a [Nullable(Decimal(P,S))](/docs/en/sql-reference/data-types/decimal.md) data type value. This family of functions includes:
+Converts an input string to a [Nullable(Decimal(P,S))](../data-types/decimal.md) data type value. This family of functions includes:
- `toDecimal32OrNull(expr, S)` — Results in `Nullable(Decimal32(S))` data type.
- `toDecimal64OrNull(expr, S)` — Results in `Nullable(Decimal64(S))` data type.
@@ -714,7 +712,7 @@ These functions should be used instead of `toDecimal*()` functions, if you prefe
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions), returns a value in the [String](/docs/en/sql-reference/data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
+- `expr` — [Expression](../syntax.md/#syntax-expressions), returns a value in the [String](../data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
- `S` — Scale, the number of decimal places in the resulting value.
**Returned value**
@@ -757,7 +755,7 @@ Result:
## toDecimal(32\|64\|128\|256)OrDefault
-Converts an input string to a [Decimal(P,S)](/docs/en/sql-reference/data-types/decimal.md) data type value. This family of functions includes:
+Converts an input string to a [Decimal(P,S)](../data-types/decimal.md) data type value. This family of functions includes:
- `toDecimal32OrDefault(expr, S)` — Results in `Decimal32(S)` data type.
- `toDecimal64OrDefault(expr, S)` — Results in `Decimal64(S)` data type.
@@ -768,7 +766,7 @@ These functions should be used instead of `toDecimal*()` functions, if you prefe
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions), returns a value in the [String](/docs/en/sql-reference/data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
+- `expr` — [Expression](../syntax.md/#syntax-expressions), returns a value in the [String](../data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
- `S` — Scale, the number of decimal places in the resulting value.
**Returned value**
@@ -810,7 +808,7 @@ Result:
## toDecimal(32\|64\|128\|256)OrZero
-Converts an input value to the [Decimal(P,S)](/docs/en/sql-reference/data-types/decimal.md) data type. This family of functions includes:
+Converts an input value to the [Decimal(P,S)](../data-types/decimal.md) data type. This family of functions includes:
- `toDecimal32OrZero( expr, S)` — Results in `Decimal32(S)` data type.
- `toDecimal64OrZero( expr, S)` — Results in `Decimal64(S)` data type.
@@ -821,7 +819,7 @@ These functions should be used instead of `toDecimal*()` functions, if you prefe
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions), returns a value in the [String](/docs/en/sql-reference/data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
+- `expr` — [Expression](../syntax.md/#syntax-expressions), returns a value in the [String](../data-types/string.md) data type. ClickHouse expects the textual representation of the decimal number. For example, `'1.111'`.
- `S` — Scale, the number of decimal places in the resulting value.
**Returned value**
@@ -921,7 +919,7 @@ Also see the `toUnixTimestamp` function.
## toFixedString(s, N)
-Converts a [String](/docs/en/sql-reference/data-types/string.md) type argument to a [FixedString(N)](/docs/en/sql-reference/data-types/fixedstring.md) type (a string of fixed length N).
+Converts a [String](../data-types/string.md) type argument to a [FixedString(N)](../data-types/fixedstring.md) type (a string of fixed length N).
If the string has fewer bytes than N, it is padded with null bytes to the right. If the string has more bytes than N, an exception is thrown.
## toStringCutToZero(s)
@@ -970,14 +968,14 @@ toDecimalString(number, scale)
**Arguments**
-- `number` — Value to be represented as String, [Int, UInt](/docs/en/sql-reference/data-types/int-uint.md), [Float](/docs/en/sql-reference/data-types/float.md), [Decimal](/docs/en/sql-reference/data-types/decimal.md),
-- `scale` — Number of fractional digits, [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
- * Maximum scale for [Decimal](/docs/en/sql-reference/data-types/decimal.md) and [Int, UInt](/docs/en/sql-reference/data-types/int-uint.md) types is 77 (it is the maximum possible number of significant digits for Decimal),
- * Maximum scale for [Float](/docs/en/sql-reference/data-types/float.md) is 60.
+- `number` — Value to be represented as String, [Int, UInt](../data-types/int-uint.md), [Float](../data-types/float.md), [Decimal](../data-types/decimal.md),
+- `scale` — Number of fractional digits, [UInt8](../data-types/int-uint.md).
+ * Maximum scale for [Decimal](../data-types/decimal.md) and [Int, UInt](../data-types/int-uint.md) types is 77 (it is the maximum possible number of significant digits for Decimal),
+ * Maximum scale for [Float](../data-types/float.md) is 60.
**Returned value**
-- Input value represented as [String](/docs/en/sql-reference/data-types/string.md) with given number of fractional digits (scale).
+- Input value represented as [String](../data-types/string.md) with given number of fractional digits (scale).
The number is rounded up or down according to common arithmetic in case requested scale is smaller than original number's scale.
**Example**
@@ -996,33 +994,689 @@ Result:
└─────────────────────────────────────────────┘
```
-## reinterpretAsUInt(8\|16\|32\|64)
+## reinterpretAsUInt8
-## reinterpretAsInt(8\|16\|32\|64)
+Performs byte reinterpretation by treating the input value as a value of type UInt8. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
-## reinterpretAsFloat(32\|64)
+**Syntax**
+
+```sql
+reinterpretAsUInt8(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt8. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt8. [UInt8](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt8(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt8(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌─x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 1 │ Int8 │ 1 │ UInt8 │
+└───┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsUInt16
+
+Performs byte reinterpretation by treating the input value as a value of type UInt16. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsUInt16(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt16. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt16. [UInt16](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt8(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt16(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌─x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 1 │ UInt8 │ 1 │ UInt16 │
+└───┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsUInt32
+
+Performs byte reinterpretation by treating the input value as a value of type UInt32. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsUInt32(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt32. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt32. [UInt32](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt16(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt32(x) AS res,
+ toTypeName(res)
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ UInt16 │ 257 │ UInt32 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsUInt64
+
+Performs byte reinterpretation by treating the input value as a value of type UInt64. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsUInt64(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt64. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt64. [UInt64](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt32(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt64(x) AS res,
+ toTypeName(res)
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ UInt32 │ 257 │ UInt64 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsUInt128
+
+Performs byte reinterpretation by treating the input value as a value of type UInt128. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsUInt128(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt128. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt128. [UInt128](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt64(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt128(x) AS res,
+ toTypeName(res)
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ UInt64 │ 257 │ UInt128 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsUInt256
+
+Performs byte reinterpretation by treating the input value as a value of type UInt256. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsUInt256(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as UInt256. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as UInt256. [UInt256](../data-types/int-uint.md/#uint8-uint16-uint32-uint64-uint128-uint256-int8-int16-int32-int64-int128-int256).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt128(257) AS x,
+ toTypeName(x),
+ reinterpretAsUInt256(x) AS res,
+ toTypeName(res)
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ UInt128 │ 257 │ UInt256 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt8
+
+Performs byte reinterpretation by treating the input value as a value of type Int8. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt8(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int8. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int8. [Int8](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toUInt8(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt8(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌─x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 1 │ UInt8 │ 1 │ Int8 │
+└───┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt16
+
+Performs byte reinterpretation by treating the input value as a value of type Int16. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt16(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int16. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int16. [Int16](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt8(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt16(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌─x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 1 │ Int8 │ 1 │ Int16 │
+└───┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt32
+
+Performs byte reinterpretation by treating the input value as a value of type Int32. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt32(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int32. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int32. [Int32](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt16(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt32(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ Int16 │ 257 │ Int32 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt64
+
+Performs byte reinterpretation by treating the input value as a value of type Int64. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt64(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int64. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int64. [Int64](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt32(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt64(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ Int32 │ 257 │ Int64 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt128
+
+Performs byte reinterpretation by treating the input value as a value of type Int128. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt128(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int128. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int128. [Int128](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt64(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt128(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ Int64 │ 257 │ Int128 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsInt256
+
+Performs byte reinterpretation by treating the input value as a value of type Int256. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsInt256(x)
+```
+
+**Parameters**
+
+- `x`: value to byte reinterpret as Int256. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Int256. [Int256](../data-types/int-uint.md/#int-ranges).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ toInt128(257) AS x,
+ toTypeName(x),
+ reinterpretAsInt256(x) AS res,
+ toTypeName(res);
+```
+
+Result:
+
+```response
+┌───x─┬─toTypeName(x)─┬─res─┬─toTypeName(res)─┐
+│ 257 │ Int128 │ 257 │ Int256 │
+└─────┴───────────────┴─────┴─────────────────┘
+```
+
+## reinterpretAsFloat32
+
+Performs byte reinterpretation by treating the input value as a value of type Float32. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsFloat32(x)
+```
+
+**Parameters**
+
+- `x`: value to reinterpret as Float32. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Float32. [Float32](../data-types/float.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT reinterpretAsUInt32(toFloat32(0.2)) as x, reinterpretAsFloat32(x);
+```
+
+Result:
+
+```response
+┌──────────x─┬─reinterpretAsFloat32(x)─┐
+│ 1045220557 │ 0.2 │
+└────────────┴─────────────────────────┘
+```
+
+## reinterpretAsFloat64
+
+Performs byte reinterpretation by treating the input value as a value of type Float64. Unlike [`CAST`](#castx-t), the function does not attempt to preserve the original value - if the target type is not able to represent the input type, the output is meaningless.
+
+**Syntax**
+
+```sql
+reinterpretAsFloat64(x)
+```
+
+**Parameters**
+
+- `x`: value to reinterpret as Float64. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Reinterpreted value `x` as Float64. [Float64](../data-types/float.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT reinterpretAsUInt64(toFloat64(0.2)) as x, reinterpretAsFloat64(x);
+```
+
+Result:
+
+```response
+┌───────────────────x─┬─reinterpretAsFloat64(x)─┐
+│ 4596373779694328218 │ 0.2 │
+└─────────────────────┴─────────────────────────┘
+```
## reinterpretAsDate
+Accepts a string, fixed string or numeric value and interprets the bytes as a number in host order (little endian). It returns a date from the interpreted number as the number of days since the beginning of the Unix Epoch.
+
+**Syntax**
+
+```sql
+reinterpretAsDate(x)
+```
+
+**Parameters**
+
+- `x`: number of days since the beginning of the Unix Epoch. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Date. [Date](../data-types/date.md).
+
+**Implementation details**
+
+:::note
+If the provided string isn’t long enough, the function works as if the string is padded with the necessary number of null bytes. If the string is longer than needed, the extra bytes are ignored.
+:::
+
+**Example**
+
+Query:
+
+```sql
+SELECT reinterpretAsDate(65), reinterpretAsDate('A');
+```
+
+Result:
+
+```response
+┌─reinterpretAsDate(65)─┬─reinterpretAsDate('A')─┐
+│ 1970-03-07 │ 1970-03-07 │
+└───────────────────────┴────────────────────────┘
+```
+
## reinterpretAsDateTime
-These functions accept a string and interpret the bytes placed at the beginning of the string as a number in host order (little endian). If the string isn’t long enough, the functions work as if the string is padded with the necessary number of null bytes. If the string is longer than needed, the extra bytes are ignored. A date is interpreted as the number of days since the beginning of the Unix Epoch, and a date with time is interpreted as the number of seconds since the beginning of the Unix Epoch.
+These functions accept a string and interpret the bytes placed at the beginning of the string as a number in host order (little endian). Returns a date with time interpreted as the number of seconds since the beginning of the Unix Epoch.
+
+**Syntax**
+
+```sql
+reinterpretAsDateTime(x)
+```
+
+**Parameters**
+
+- `x`: number of seconds since the beginning of the Unix Epoch. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md), [UUID](../data-types/uuid.md), [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
+
+**Returned value**
+
+- Date and Time. [DateTime](../data-types/datetime.md).
+
+**Implementation details**
+
+:::note
+If the provided string isn’t long enough, the function works as if the string is padded with the necessary number of null bytes. If the string is longer than needed, the extra bytes are ignored.
+:::
+
+**Example**
+
+Query:
+
+```sql
+SELECT reinterpretAsDateTime(65), reinterpretAsDateTime('A');
+```
+
+Result:
+
+```response
+┌─reinterpretAsDateTime(65)─┬─reinterpretAsDateTime('A')─┐
+│ 1970-01-01 01:01:05 │ 1970-01-01 01:01:05 │
+└───────────────────────────┴────────────────────────────┘
+```
## reinterpretAsString
-This function accepts a number or date or date with time and returns a string containing bytes representing the corresponding value in host order (little endian). Null bytes are dropped from the end. For example, a UInt32 type value of 255 is a string that is one byte long.
+This function accepts a number, date or date with time and returns a string containing bytes representing the corresponding value in host order (little endian). Null bytes are dropped from the end. For example, a UInt32 type value of 255 is a string that is one byte long.
+
+**Syntax**
+
+```sql
+reinterpretAsString(x)
+```
+
+**Parameters**
+
+- `x`: value to reinterpret to string. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md).
+
+**Returned value**
+
+- String containing bytes representing `x`. [String](../data-types/fixedstring.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ reinterpretAsString(toDateTime('1970-01-01 01:01:05')),
+ reinterpretAsString(toDate('1970-03-07'));
+```
+
+Result:
+
+```response
+┌─reinterpretAsString(toDateTime('1970-01-01 01:01:05'))─┬─reinterpretAsString(toDate('1970-03-07'))─┐
+│ A │ A │
+└────────────────────────────────────────────────────────┴───────────────────────────────────────────┘
+```
## reinterpretAsFixedString
-This function accepts a number or date or date with time and returns a FixedString containing bytes representing the corresponding value in host order (little endian). Null bytes are dropped from the end. For example, a UInt32 type value of 255 is a FixedString that is one byte long.
+This function accepts a number, date or date with time and returns a FixedString containing bytes representing the corresponding value in host order (little endian). Null bytes are dropped from the end. For example, a UInt32 type value of 255 is a FixedString that is one byte long.
+
+**Syntax**
+
+```sql
+reinterpretAsFixedString(x)
+```
+
+**Parameters**
+
+- `x`: value to reinterpret to string. [(U)Int*](../data-types/int-uint.md), [Float](../data-types/float.md), [Date](../data-types/date.md), [DateTime](../data-types/datetime.md).
+
+**Returned value**
+
+- Fixed string containing bytes representing `x`. [FixedString](../data-types/fixedstring.md).
+
+**Example**
+
+Query:
+
+```sql
+SELECT
+ reinterpretAsFixedString(toDateTime('1970-01-01 01:01:05')),
+ reinterpretAsFixedString(toDate('1970-03-07'));
+```
+
+Result:
+
+```response
+┌─reinterpretAsFixedString(toDateTime('1970-01-01 01:01:05'))─┬─reinterpretAsFixedString(toDate('1970-03-07'))─┐
+│ A │ A │
+└─────────────────────────────────────────────────────────────┴────────────────────────────────────────────────┘
+```
## reinterpretAsUUID
:::note
-In addition to the UUID functions listed here, there is dedicated [UUID function documentation](/docs/en/sql-reference/functions/uuid-functions.md).
+In addition to the UUID functions listed here, there is dedicated [UUID function documentation](../functions/uuid-functions.md).
:::
-Accepts 16 bytes string and returns UUID containing bytes representing the corresponding value in network byte order (big-endian). If the string isn't long enough, the function works as if the string is padded with the necessary number of null bytes to the end. If the string is longer than 16 bytes, the extra bytes at the end are ignored.
+Accepts a 16 byte string and returns a UUID containing bytes representing the corresponding value in network byte order (big-endian). If the string isn't long enough, the function works as if the string is padded with the necessary number of null bytes to the end. If the string is longer than 16 bytes, the extra bytes at the end are ignored.
**Syntax**
@@ -1032,11 +1686,11 @@ reinterpretAsUUID(fixed_string)
**Arguments**
-- `fixed_string` — Big-endian byte string. [FixedString](/docs/en/sql-reference/data-types/fixedstring.md/#fixedstring).
+- `fixed_string` — Big-endian byte string. [FixedString](../data-types/fixedstring.md/#fixedstring).
**Returned value**
-- The UUID type value. [UUID](/docs/en/sql-reference/data-types/uuid.md/#uuid-data-type).
+- The UUID type value. [UUID](../data-types/uuid.md/#uuid-data-type).
**Examples**
@@ -1089,7 +1743,7 @@ reinterpret(x, type)
**Arguments**
- `x` — Any type.
-- `type` — Destination type. [String](/docs/en/sql-reference/data-types/string.md).
+- `type` — Destination type. [String](../data-types/string.md).
**Returned value**
@@ -1128,7 +1782,7 @@ x::t
**Arguments**
- `x` — A value to convert. May be of any type.
-- `T` — The name of the target data type. [String](/docs/en/sql-reference/data-types/string.md).
+- `T` — The name of the target data type. [String](../data-types/string.md).
- `t` — The target data type.
**Returned value**
@@ -1177,9 +1831,9 @@ Result:
└─────────────────────┴─────────────────────┴────────────┴─────────────────────┴───────────────────────────┘
```
-Conversion to [FixedString (N)](/docs/en/sql-reference/data-types/fixedstring.md) only works for arguments of type [String](/docs/en/sql-reference/data-types/string.md) or [FixedString](/docs/en/sql-reference/data-types/fixedstring.md).
+Conversion to [FixedString (N)](../data-types/fixedstring.md) only works for arguments of type [String](../data-types/string.md) or [FixedString](../data-types/fixedstring.md).
-Type conversion to [Nullable](/docs/en/sql-reference/data-types/nullable.md) and back is supported.
+Type conversion to [Nullable](../data-types/nullable.md) and back is supported.
**Example**
@@ -1253,7 +1907,7 @@ Code: 70. DB::Exception: Received from localhost:9000. DB::Exception: Value in c
## accurateCastOrNull(x, T)
-Converts input value `x` to the specified data type `T`. Always returns [Nullable](/docs/en/sql-reference/data-types/nullable.md) type and returns [NULL](/docs/en/sql-reference/syntax.md/#null-literal) if the casted value is not representable in the target type.
+Converts input value `x` to the specified data type `T`. Always returns [Nullable](../data-types/nullable.md) type and returns [NULL](../syntax.md/#null-literal) if the casted value is not representable in the target type.
**Syntax**
@@ -1362,7 +2016,7 @@ Result:
## toInterval(Year\|Quarter\|Month\|Week\|Day\|Hour\|Minute\|Second)
-Converts a Number type argument to an [Interval](/docs/en/sql-reference/data-types/special-data-types/interval.md) data type.
+Converts a Number type argument to an [Interval](../data-types/special-data-types/interval.md) data type.
**Syntax**
@@ -1409,9 +2063,9 @@ Result:
## parseDateTime {#type_conversion_functions-parseDateTime}
-Converts a [String](/docs/en/sql-reference/data-types/string.md) to [DateTime](/docs/en/sql-reference/data-types/datetime.md) according to a [MySQL format string](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format).
+Converts a [String](../data-types/string.md) to [DateTime](../data-types/datetime.md) according to a [MySQL format string](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format).
-This function is the opposite operation of function [formatDateTime](/docs/en/sql-reference/functions/date-time-functions.md#date_time_functions-formatDateTime).
+This function is the opposite operation of function [formatDateTime](../functions/date-time-functions.md#date_time_functions-formatDateTime).
**Syntax**
@@ -1431,7 +2085,7 @@ Returns DateTime values parsed from input string according to a MySQL style form
**Supported format specifiers**
-All format specifiers listed in [formatDateTime](/docs/en/sql-reference/functions/date-time-functions.md#date_time_functions-formatDateTime) except:
+All format specifiers listed in [formatDateTime](../functions/date-time-functions.md#date_time_functions-formatDateTime) except:
- %Q: Quarter (1-4)
**Example**
@@ -1460,7 +2114,7 @@ Alias: `str_to_date`.
Similar to [parseDateTime](#parsedatetime), except that the format string is in [Joda](https://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) instead of MySQL syntax.
-This function is the opposite operation of function [formatDateTimeInJodaSyntax](/docs/en/sql-reference/functions/date-time-functions.md#date_time_functions-formatDateTimeInJodaSyntax).
+This function is the opposite operation of function [formatDateTimeInJodaSyntax](../functions/date-time-functions.md#date_time_functions-formatDateTimeInJodaSyntax).
**Syntax**
@@ -1480,7 +2134,7 @@ Returns DateTime values parsed from input string according to a Joda style forma
**Supported format specifiers**
-All format specifiers listed in [formatDateTimeInJoda](/docs/en/sql-reference/functions/date-time-functions.md#date_time_functions-formatDateTime) are supported, except:
+All format specifiers listed in [formatDateTimeInJoda](../functions/date-time-functions.md#date_time_functions-formatDateTime) are supported, except:
- S: fraction of second
- z: time zone
- Z: time zone offset/id
@@ -1506,7 +2160,7 @@ Same as for [parseDateTimeInJodaSyntax](#type_conversion_functions-parseDateTime
## parseDateTimeBestEffort
## parseDateTime32BestEffort
-Converts a date and time in the [String](/docs/en/sql-reference/data-types/string.md) representation to [DateTime](/docs/en/sql-reference/data-types/datetime.md/#data_type-datetime) data type.
+Converts a date and time in the [String](../data-types/string.md) representation to [DateTime](../data-types/datetime.md/#data_type-datetime) data type.
The function parses [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), [RFC 1123 - 5.2.14 RFC-822 Date and Time Specification](https://tools.ietf.org/html/rfc1123#page-55), ClickHouse’s and some other date and time formats.
@@ -1518,8 +2172,8 @@ parseDateTimeBestEffort(time_string [, time_zone])
**Arguments**
-- `time_string` — String containing a date and time to convert. [String](/docs/en/sql-reference/data-types/string.md).
-- `time_zone` — Time zone. The function parses `time_string` according to the time zone. [String](/docs/en/sql-reference/data-types/string.md).
+- `time_string` — String containing a date and time to convert. [String](../data-types/string.md).
+- `time_zone` — Time zone. The function parses `time_string` according to the time zone. [String](../data-types/string.md).
**Supported non-standard formats**
@@ -1535,7 +2189,7 @@ If the year is not specified, it is considered to be equal to the current year.
**Returned value**
-- `time_string` converted to the [DateTime](/docs/en/sql-reference/data-types/datetime.md) data type.
+- `time_string` converted to the [DateTime](../data-types/datetime.md) data type.
**Examples**
@@ -1667,7 +2321,7 @@ Same as [parseDateTimeBestEffortUS](#parsedatetimebesteffortUS) function except
## parseDateTime64BestEffort
-Same as [parseDateTimeBestEffort](#parsedatetimebesteffort) function but also parse milliseconds and microseconds and returns [DateTime](/docs/en/sql-reference/functions/type-conversion-functions.md/#data_type-datetime) data type.
+Same as [parseDateTimeBestEffort](#parsedatetimebesteffort) function but also parse milliseconds and microseconds and returns [DateTime](../functions/type-conversion-functions.md/#data_type-datetime) data type.
**Syntax**
@@ -1677,13 +2331,13 @@ parseDateTime64BestEffort(time_string [, precision [, time_zone]])
**Arguments**
-- `time_string` — String containing a date or date with time to convert. [String](/docs/en/sql-reference/data-types/string.md).
-- `precision` — Required precision. `3` — for milliseconds, `6` — for microseconds. Default — `3`. Optional. [UInt8](/docs/en/sql-reference/data-types/int-uint.md).
-- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](/docs/en/sql-reference/data-types/string.md).
+- `time_string` — String containing a date or date with time to convert. [String](../data-types/string.md).
+- `precision` — Required precision. `3` — for milliseconds, `6` — for microseconds. Default — `3`. Optional. [UInt8](../data-types/int-uint.md).
+- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](../data-types/string.md).
**Returned value**
-- `time_string` converted to the [DateTime](/docs/en/sql-reference/data-types/datetime.md) data type.
+- `time_string` converted to the [DateTime](../data-types/datetime.md) data type.
**Examples**
@@ -1733,7 +2387,7 @@ Same as for [parseDateTime64BestEffort](#parsedatetime64besteffort), except that
## toLowCardinality
-Converts input parameter to the [LowCardinality](/docs/en/sql-reference/data-types/lowcardinality.md) version of same data type.
+Converts input parameter to the [LowCardinality](../data-types/lowcardinality.md) version of same data type.
To convert data from the `LowCardinality` data type use the [CAST](#type_conversion_function-cast) function. For example, `CAST(x as String)`.
@@ -1745,13 +2399,11 @@ toLowCardinality(expr)
**Arguments**
-- `expr` — [Expression](/docs/en/sql-reference/syntax.md/#syntax-expressions) resulting in one of the [supported data types](/docs/en/sql-reference/data-types/index.md/#data_types).
+- `expr` — [Expression](../syntax.md/#syntax-expressions) resulting in one of the [supported data types](../data-types/index.md/#data_types).
**Returned values**
-- Result of `expr`.
-
-Type: `LowCardinality(expr_result_type)`
+- Result of `expr`. [LowCardinality](../data-types/lowcardinality.md) of the type of `expr`.
**Example**
@@ -1979,143 +2631,3 @@ Result:
│ 2,"good" │
└───────────────────────────────────────────┘
```
-
-## snowflakeToDateTime
-
-Extracts the timestamp component of a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) in [DateTime](/docs/en/sql-reference/data-types/datetime.md) format.
-
-**Syntax**
-
-``` sql
-snowflakeToDateTime(value[, time_zone])
-```
-
-**Arguments**
-
-- `value` — Snowflake ID. [Int64](/docs/en/sql-reference/data-types/int-uint.md).
-- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](/docs/en/sql-reference/data-types/string.md).
-
-**Returned value**
-
-- The timestamp component of `value` as a [DateTime](/docs/en/sql-reference/data-types/datetime.md) value.
-
-**Example**
-
-Query:
-
-``` sql
-SELECT snowflakeToDateTime(CAST('1426860702823350272', 'Int64'), 'UTC');
-```
-
-Result:
-
-```response
-
-┌─snowflakeToDateTime(CAST('1426860702823350272', 'Int64'), 'UTC')─┐
-│ 2021-08-15 10:57:56 │
-└──────────────────────────────────────────────────────────────────┘
-```
-
-## snowflakeToDateTime64
-
-Extracts the timestamp component of a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) in [DateTime64](/docs/en/sql-reference/data-types/datetime64.md) format.
-
-**Syntax**
-
-``` sql
-snowflakeToDateTime64(value[, time_zone])
-```
-
-**Arguments**
-
-- `value` — Snowflake ID. [Int64](/docs/en/sql-reference/data-types/int-uint.md).
-- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](/docs/en/sql-reference/data-types/string.md).
-
-**Returned value**
-
-- The timestamp component of `value` as a [DateTime64](/docs/en/sql-reference/data-types/datetime64.md) with scale = 3, i.e. millisecond precision.
-
-**Example**
-
-Query:
-
-``` sql
-SELECT snowflakeToDateTime64(CAST('1426860802823350272', 'Int64'), 'UTC');
-```
-
-Result:
-
-```response
-
-┌─snowflakeToDateTime64(CAST('1426860802823350272', 'Int64'), 'UTC')─┐
-│ 2021-08-15 10:58:19.841 │
-└────────────────────────────────────────────────────────────────────┘
-```
-
-## dateTimeToSnowflake
-
-Converts a [DateTime](/docs/en/sql-reference/data-types/datetime.md) value to the first [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) at the giving time.
-
-**Syntax**
-
-``` sql
-dateTimeToSnowflake(value)
-```
-
-**Arguments**
-
-- `value` — Date with time. [DateTime](/docs/en/sql-reference/data-types/datetime.md).
-
-**Returned value**
-
-- Input value converted to the [Int64](/docs/en/sql-reference/data-types/int-uint.md) data type as the first Snowflake ID at that time.
-
-**Example**
-
-Query:
-
-``` sql
-WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS dt SELECT dateTimeToSnowflake(dt);
-```
-
-Result:
-
-```response
-┌─dateTimeToSnowflake(dt)─┐
-│ 1426860702823350272 │
-└─────────────────────────┘
-```
-
-## dateTime64ToSnowflake
-
-Convert a [DateTime64](/docs/en/sql-reference/data-types/datetime64.md) to the first [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) at the giving time.
-
-**Syntax**
-
-``` sql
-dateTime64ToSnowflake(value)
-```
-
-**Arguments**
-
-- `value` — Date with time. [DateTime64](/docs/en/sql-reference/data-types/datetime64.md).
-
-**Returned value**
-
-- Input value converted to the [Int64](/docs/en/sql-reference/data-types/int-uint.md) data type as the first Snowflake ID at that time.
-
-**Example**
-
-Query:
-
-``` sql
-WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS dt64 SELECT dateTime64ToSnowflake(dt64);
-```
-
-Result:
-
-```response
-┌─dateTime64ToSnowflake(dt64)─┐
-│ 1426860704886947840 │
-└─────────────────────────────┘
-```
diff --git a/docs/en/sql-reference/functions/ulid-functions.md b/docs/en/sql-reference/functions/ulid-functions.md
index eb69b1779ae..dc6a803d638 100644
--- a/docs/en/sql-reference/functions/ulid-functions.md
+++ b/docs/en/sql-reference/functions/ulid-functions.md
@@ -18,7 +18,7 @@ generateULID([x])
**Arguments**
-- `x` — [Expression](../../sql-reference/syntax.md#syntax-expressions) resulting in any of the [supported data types](../../sql-reference/data-types/index.md#data_types). The resulting value is discarded, but the expression itself if used for bypassing [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in one query. Optional parameter.
+- `x` — [Expression](../../sql-reference/syntax.md#syntax-expressions) resulting in any of the [supported data types](../data-types/index.md#data_types). The resulting value is discarded, but the expression itself if used for bypassing [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in one query. Optional parameter.
**Returned value**
@@ -60,14 +60,12 @@ ULIDStringToDateTime(ulid[, timezone])
**Arguments**
-- `ulid` — Input ULID. [String](/docs/en/sql-reference/data-types/string.md) or [FixedString(26)](/docs/en/sql-reference/data-types/fixedstring.md).
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../../sql-reference/data-types/string.md).
+- `ulid` — Input ULID. [String](../data-types/string.md) or [FixedString(26)](../data-types/fixedstring.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../data-types/string.md).
**Returned value**
-- Timestamp with milliseconds precision.
-
-Type: [DateTime64(3)](/docs/en/sql-reference/data-types/datetime64.md).
+- Timestamp with milliseconds precision. [DateTime64(3)](../data-types/datetime64.md).
**Usage example**
diff --git a/docs/en/sql-reference/functions/url-functions.md b/docs/en/sql-reference/functions/url-functions.md
index cf2940d63e1..47890e0b271 100644
--- a/docs/en/sql-reference/functions/url-functions.md
+++ b/docs/en/sql-reference/functions/url-functions.md
@@ -16,7 +16,7 @@ If the relevant part isn’t present in a URL, an empty string is returned.
Extracts the protocol from a URL.
-Examples of typical returned values: http, https, ftp, mailto, tel, magnet…
+Examples of typical returned values: http, https, ftp, mailto, tel, magnet...
### domain
@@ -28,7 +28,7 @@ domain(url)
**Arguments**
-- `url` — URL. Type: [String](../../sql-reference/data-types/string.md).
+- `url` — URL. [String](../data-types/string.md).
The URL can be specified with or without a scheme. Examples:
@@ -48,10 +48,7 @@ clickhouse.com
**Returned values**
-- Host name. If ClickHouse can parse the input string as a URL.
-- Empty string. If ClickHouse can’t parse the input string as a URL.
-
-Type: `String`.
+- Host name if ClickHouse can parse the input string as a URL, otherwise an empty string. [String](../data-types/string.md).
**Example**
@@ -79,7 +76,7 @@ topLevelDomain(url)
**Arguments**
-- `url` — URL. Type: [String](../../sql-reference/data-types/string.md).
+- `url` — URL. [String](../data-types/string.md).
The URL can be specified with or without a scheme. Examples:
@@ -91,10 +88,7 @@ https://clickhouse.com/time/
**Returned values**
-- Domain name. If ClickHouse can parse the input string as a URL.
-- Empty string. If ClickHouse cannot parse the input string as a URL.
-
-Type: `String`.
+- Domain name if ClickHouse can parse the input string as a URL. Otherwise, an empty string. [String](../data-types/string.md).
**Example**
@@ -157,14 +151,12 @@ cutToFirstSignificantSubdomainCustom(URL, TLD)
**Arguments**
-- `URL` — URL. [String](../../sql-reference/data-types/string.md).
-- `TLD` — Custom TLD list name. [String](../../sql-reference/data-types/string.md).
+- `URL` — URL. [String](../data-types/string.md).
+- `TLD` — Custom TLD list name. [String](../data-types/string.md).
**Returned value**
-- Part of the domain that includes top-level subdomains up to the first significant subdomain.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Part of the domain that includes top-level subdomains up to the first significant subdomain. [String](../data-types/string.md).
**Example**
@@ -211,14 +203,12 @@ cutToFirstSignificantSubdomainCustomWithWWW(URL, TLD)
**Arguments**
-- `URL` — URL. [String](../../sql-reference/data-types/string.md).
-- `TLD` — Custom TLD list name. [String](../../sql-reference/data-types/string.md).
+- `URL` — URL. [String](../data-types/string.md).
+- `TLD` — Custom TLD list name. [String](../data-types/string.md).
**Returned value**
-- Part of the domain that includes top-level subdomains up to the first significant subdomain without stripping `www`.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- Part of the domain that includes top-level subdomains up to the first significant subdomain without stripping `www`. [String](../data-types/string.md).
**Example**
@@ -265,14 +255,12 @@ firstSignificantSubdomainCustom(URL, TLD)
**Arguments**
-- `URL` — URL. [String](../../sql-reference/data-types/string.md).
-- `TLD` — Custom TLD list name. [String](../../sql-reference/data-types/string.md).
+- `URL` — URL. [String](../data-types/string.md).
+- `TLD` — Custom TLD list name. [String](../data-types/string.md).
**Returned value**
-- First significant subdomain.
-
-Type: [String](../../sql-reference/data-types/string.md).
+- First significant subdomain. [String](../data-types/string.md).
**Example**
@@ -418,13 +406,11 @@ netloc(URL)
**Arguments**
-- `url` — URL. [String](../../sql-reference/data-types/string.md).
+- `url` — URL. [String](../data-types/string.md).
**Returned value**
-- `username:password@host:port`.
-
-Type: `String`.
+- `username:password@host:port`. [String](../data-types/string.md).
**Example**
@@ -474,14 +460,12 @@ cutURLParameter(URL, name)
**Arguments**
-- `url` — URL. [String](../../sql-reference/data-types/string.md).
-- `name` — name of URL parameter. [String](../../sql-reference/data-types/string.md) or [Array](../../sql-reference/data-types/array.md) of Strings.
+- `url` — URL. [String](../data-types/string.md).
+- `name` — name of URL parameter. [String](../data-types/string.md) or [Array](../data-types/array.md) of Strings.
**Returned value**
-- URL with `name` URL parameter removed.
-
-Type: `String`.
+- URL with `name` URL parameter removed. [String](../data-types/string.md).
**Example**
diff --git a/docs/en/sql-reference/functions/uuid-functions.md b/docs/en/sql-reference/functions/uuid-functions.md
index d1b833c2439..2707f0bf8d4 100644
--- a/docs/en/sql-reference/functions/uuid-functions.md
+++ b/docs/en/sql-reference/functions/uuid-functions.md
@@ -18,7 +18,7 @@ generateUUIDv4([expr])
**Arguments**
-- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
+- `expr` — An arbitrary [expression](../syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
**Returned value**
@@ -90,7 +90,7 @@ generateUUIDv7([expr])
**Arguments**
-- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
+- `expr` — An arbitrary [expression](../syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
**Returned value**
@@ -163,7 +163,7 @@ generateUUIDv7ThreadMonotonic([expr])
**Arguments**
-- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
+- `expr` — An arbitrary [expression](../syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
**Returned value**
@@ -233,7 +233,7 @@ generateUUIDv7NonMonotonic([expr])
**Arguments**
-- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
+- `expr` — An arbitrary [expression](../syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned UUID. Optional.
**Returned value**
@@ -289,9 +289,7 @@ The function also works for [Arrays](array-functions.md#function-empty) and [Str
**Returned value**
-- Returns `1` for an empty UUID or `0` for a non-empty UUID.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for an empty UUID or `0` for a non-empty UUID. [UInt8](../data-types/int-uint.md).
**Example**
@@ -331,9 +329,7 @@ The function also works for [Arrays](array-functions.md#function-notempty) or [S
**Returned value**
-- Returns `1` for a non-empty UUID or `0` for an empty UUID.
-
-Type: [UInt8](../data-types/int-uint.md).
+- Returns `1` for a non-empty UUID or `0` for an empty UUID. [UInt8](../data-types/int-uint.md).
**Example**
@@ -383,8 +379,8 @@ Result:
**Arguments**
-- `string` — String of 36 characters or FixedString(36). [String](../../sql-reference/syntax.md#string).
-- `default` — UUID to be used as the default if the first argument cannot be converted to a UUID type. [UUID](/docs/en/sql-reference/data-types/uuid.md).
+- `string` — String of 36 characters or FixedString(36). [String](../syntax.md#string).
+- `default` — UUID to be used as the default if the first argument cannot be converted to a UUID type. [UUID](../data-types/uuid.md).
**Returned value**
@@ -482,7 +478,7 @@ Result:
## UUIDStringToNum
-Accepts `string` containing 36 characters in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, and returns a [FixedString(16)](../../sql-reference/data-types/fixedstring.md) as its binary representation, with its format optionally specified by `variant` (`Big-endian` by default).
+Accepts `string` containing 36 characters in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, and returns a [FixedString(16)](../data-types/fixedstring.md) as its binary representation, with its format optionally specified by `variant` (`Big-endian` by default).
**Syntax**
@@ -492,7 +488,7 @@ UUIDStringToNum(string[, variant = 1])
**Arguments**
-- `string` — A [String](../../sql-reference/syntax.md#syntax-string-literal) of 36 characters or [FixedString](../../sql-reference/syntax.md#syntax-string-literal)
+- `string` — A [String](../syntax.md#syntax-string-literal) of 36 characters or [FixedString](../syntax.md#syntax-string-literal)
- `variant` — Integer, representing a variant as specified by [RFC4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.1). 1 = `Big-endian` (default), 2 = `Microsoft`.
**Returned value**
@@ -541,7 +537,7 @@ UUIDNumToString(binary[, variant = 1])
**Arguments**
-- `binary` — [FixedString(16)](../../sql-reference/data-types/fixedstring.md) as a binary representation of a UUID.
+- `binary` — [FixedString(16)](../data-types/fixedstring.md) as a binary representation of a UUID.
- `variant` — Integer, representing a variant as specified by [RFC4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.1). 1 = `Big-endian` (default), 2 = `Microsoft`.
**Returned value**
@@ -580,7 +576,7 @@ Result:
## UUIDToNum
-Accepts a [UUID](../../sql-reference/data-types/uuid.md) and returns its binary representation as a [FixedString(16)](../../sql-reference/data-types/fixedstring.md), with its format optionally specified by `variant` (`Big-endian` by default). This function replaces calls to two separate functions `UUIDStringToNum(toString(uuid))` so no intermediate conversion from UUID to string is required to extract bytes from a UUID.
+Accepts a [UUID](../data-types/uuid.md) and returns its binary representation as a [FixedString(16)](../data-types/fixedstring.md), with its format optionally specified by `variant` (`Big-endian` by default). This function replaces calls to two separate functions `UUIDStringToNum(toString(uuid))` so no intermediate conversion from UUID to string is required to extract bytes from a UUID.
**Syntax**
@@ -640,13 +636,11 @@ UUIDv7ToDateTime(uuid[, timezone])
**Arguments**
- `uuid` — [UUID](../data-types/uuid.md) of version 7.
-- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../../sql-reference/data-types/string.md).
+- `timezone` — [Timezone name](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-timezone) for the returned value (optional). [String](../data-types/string.md).
**Returned value**
-- Timestamp with milliseconds precision. If the UUID is not a valid version 7 UUID, it returns 1970-01-01 00:00:00.000.
-
-Type: [DateTime64(3)](/docs/en/sql-reference/data-types/datetime64.md).
+- Timestamp with milliseconds precision. If the UUID is not a valid version 7 UUID, it returns 1970-01-01 00:00:00.000. [DateTime64(3)](../data-types/datetime64.md).
**Usage examples**
@@ -674,7 +668,7 @@ Result:
└──────────────────────────────────────────────────────────────────────────────────────┘
```
-## serverUUID()
+## serverUUID
Returns the random UUID generated during the first start of the ClickHouse server. The UUID is stored in file `uuid` in the ClickHouse server directory (e.g. `/var/lib/clickhouse/`) and retained between server restarts.
@@ -686,10 +680,277 @@ serverUUID()
**Returned value**
-- The UUID of the server.
+- The UUID of the server. [UUID](../data-types/uuid.md).
-Type: [UUID](../data-types/uuid.md).
+## generateSnowflakeID
+
+Generates a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID).
+
+The generated Snowflake ID contains the current Unix timestamp in milliseconds 41 (+ 1 top zero bit) bits, followed by machine id (10 bits), a counter (12 bits) to distinguish IDs within a millisecond.
+For any given timestamp (unix_ts_ms), the counter starts at 0 and is incremented by 1 for each new Snowflake ID until the timestamp changes.
+In case the counter overflows, the timestamp field is incremented by 1 and the counter is reset to 0.
+
+Function `generateSnowflakeID` guarantees that the counter field within a timestamp increments monotonically across all function invocations in concurrently running threads and queries.
+
+```
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
+|0| timestamp |
+├─┼ ┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
+| | machine_id | machine_seq_num |
+└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
+```
+
+**Syntax**
+
+``` sql
+generateSnowflakeID([expr])
+```
+
+**Arguments**
+
+- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned Snowflake ID. Optional.
+
+**Returned value**
+
+A value of type UInt64.
+
+**Example**
+
+First, create a table with a column of type UInt64, then insert a generated Snowflake ID into the table.
+
+``` sql
+CREATE TABLE tab (id UInt64) ENGINE = Memory;
+
+INSERT INTO tab SELECT generateSnowflakeID();
+
+SELECT * FROM tab;
+```
+
+Result:
+
+```response
+┌──────────────────id─┐
+│ 7199081390080409600 │
+└─────────────────────┘
+```
+
+**Example with multiple Snowflake IDs generated per row**
+
+```sql
+SELECT generateSnowflakeID(1), generateSnowflakeID(2);
+
+┌─generateSnowflakeID(1)─┬─generateSnowflakeID(2)─┐
+│ 7199081609652224000 │ 7199081609652224001 │
+└────────────────────────┴────────────────────────┘
+```
+
+## generateSnowflakeIDThreadMonotonic
+
+Generates a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID).
+
+The generated Snowflake ID contains the current Unix timestamp in milliseconds 41 (+ 1 top zero bit) bits, followed by machine id (10 bits), a counter (12 bits) to distinguish IDs within a millisecond.
+For any given timestamp (unix_ts_ms), the counter starts at 0 and is incremented by 1 for each new Snowflake ID until the timestamp changes.
+In case the counter overflows, the timestamp field is incremented by 1 and the counter is reset to 0.
+
+This function behaves like `generateSnowflakeID` but gives no guarantee on counter monotony across different simultaneous requests.
+Monotonicity within one timestamp is guaranteed only within the same thread calling this function to generate Snowflake IDs.
+
+```
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
+|0| timestamp |
+├─┼ ┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
+| | machine_id | machine_seq_num |
+└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
+```
+
+**Syntax**
+
+``` sql
+generateSnowflakeIDThreadMonotonic([expr])
+```
+
+**Arguments**
+
+- `expr` — An arbitrary [expression](../../sql-reference/syntax.md#syntax-expressions) used to bypass [common subexpression elimination](../../sql-reference/functions/index.md#common-subexpression-elimination) if the function is called multiple times in a query. The value of the expression has no effect on the returned Snowflake ID. Optional.
+
+**Returned value**
+
+A value of type UInt64.
+
+**Example**
+
+First, create a table with a column of type UInt64, then insert a generated Snowflake ID into the table.
+
+``` sql
+CREATE TABLE tab (id UInt64) ENGINE = Memory;
+
+INSERT INTO tab SELECT generateSnowflakeIDThreadMonotonic();
+
+SELECT * FROM tab;
+```
+
+Result:
+
+```response
+┌──────────────────id─┐
+│ 7199082832006627328 │
+└─────────────────────┘
+```
+
+**Example with multiple Snowflake IDs generated per row**
+
+```sql
+SELECT generateSnowflakeIDThreadMonotonic(1), generateSnowflakeIDThreadMonotonic(2);
+
+┌─generateSnowflakeIDThreadMonotonic(1)─┬─generateSnowflakeIDThreadMonotonic(2)─┐
+│ 7199082940311945216 │ 7199082940316139520 │
+└───────────────────────────────────────┴───────────────────────────────────────┘
+```
+
+## snowflakeToDateTime
+
+Extracts the timestamp component of a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) in [DateTime](../data-types/datetime.md) format.
+
+**Syntax**
+
+``` sql
+snowflakeToDateTime(value[, time_zone])
+```
+
+**Arguments**
+
+- `value` — Snowflake ID. [Int64](../data-types/int-uint.md).
+- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](../data-types/string.md).
+
+**Returned value**
+
+- The timestamp component of `value` as a [DateTime](../data-types/datetime.md) value.
+
+**Example**
+
+Query:
+
+``` sql
+SELECT snowflakeToDateTime(CAST('1426860702823350272', 'Int64'), 'UTC');
+```
+
+Result:
+
+```response
+
+┌─snowflakeToDateTime(CAST('1426860702823350272', 'Int64'), 'UTC')─┐
+│ 2021-08-15 10:57:56 │
+└──────────────────────────────────────────────────────────────────┘
+```
+
+## snowflakeToDateTime64
+
+Extracts the timestamp component of a [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) in [DateTime64](../data-types/datetime64.md) format.
+
+**Syntax**
+
+``` sql
+snowflakeToDateTime64(value[, time_zone])
+```
+
+**Arguments**
+
+- `value` — Snowflake ID. [Int64](../data-types/int-uint.md).
+- `time_zone` — [Timezone](/docs/en/operations/server-configuration-parameters/settings.md/#server_configuration_parameters-timezone). The function parses `time_string` according to the timezone. Optional. [String](../data-types/string.md).
+
+**Returned value**
+
+- The timestamp component of `value` as a [DateTime64](../data-types/datetime64.md) with scale = 3, i.e. millisecond precision.
+
+**Example**
+
+Query:
+
+``` sql
+SELECT snowflakeToDateTime64(CAST('1426860802823350272', 'Int64'), 'UTC');
+```
+
+Result:
+
+```response
+
+┌─snowflakeToDateTime64(CAST('1426860802823350272', 'Int64'), 'UTC')─┐
+│ 2021-08-15 10:58:19.841 │
+└────────────────────────────────────────────────────────────────────┘
+```
+
+## dateTimeToSnowflake
+
+Converts a [DateTime](../data-types/datetime.md) value to the first [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) at the giving time.
+
+**Syntax**
+
+``` sql
+dateTimeToSnowflake(value)
+```
+
+**Arguments**
+
+- `value` — Date with time. [DateTime](../data-types/datetime.md).
+
+**Returned value**
+
+- Input value converted to the [Int64](../data-types/int-uint.md) data type as the first Snowflake ID at that time.
+
+**Example**
+
+Query:
+
+``` sql
+WITH toDateTime('2021-08-15 18:57:56', 'Asia/Shanghai') AS dt SELECT dateTimeToSnowflake(dt);
+```
+
+Result:
+
+```response
+┌─dateTimeToSnowflake(dt)─┐
+│ 1426860702823350272 │
+└─────────────────────────┘
+```
+
+## dateTime64ToSnowflake
+
+Convert a [DateTime64](../data-types/datetime64.md) to the first [Snowflake ID](https://en.wikipedia.org/wiki/Snowflake_ID) at the giving time.
+
+**Syntax**
+
+``` sql
+dateTime64ToSnowflake(value)
+```
+
+**Arguments**
+
+- `value` — Date with time. [DateTime64](../data-types/datetime64.md).
+
+**Returned value**
+
+- Input value converted to the [Int64](../data-types/int-uint.md) data type as the first Snowflake ID at that time.
+
+**Example**
+
+Query:
+
+``` sql
+WITH toDateTime64('2021-08-15 18:57:56.492', 3, 'Asia/Shanghai') AS dt64 SELECT dateTime64ToSnowflake(dt64);
+```
+
+Result:
+
+```response
+┌─dateTime64ToSnowflake(dt64)─┐
+│ 1426860704886947840 │
+└─────────────────────────────┘
+```
## See also
-- [dictGetUUID](../../sql-reference/functions/ext-dict-functions.md#ext_dict_functions-other)
+- [dictGetUUID](../functions/ext-dict-functions.md#ext_dict_functions-other)
diff --git a/docs/en/sql-reference/functions/ym-dict-functions.md b/docs/en/sql-reference/functions/ym-dict-functions.md
index 043686889c4..03251f0b9af 100644
--- a/docs/en/sql-reference/functions/ym-dict-functions.md
+++ b/docs/en/sql-reference/functions/ym-dict-functions.md
@@ -432,13 +432,13 @@ regionIn(lhs, rhs\[, geobase\])
**Parameters**
-- `lhs` — Lhs region ID from the geobase. [UInt32](../../sql-reference/data-types/int-uint).
-- `rhs` — Rhs region ID from the geobase. [UInt32](../../sql-reference/data-types/int-uint).
+- `lhs` — Lhs region ID from the geobase. [UInt32](../data-types/int-uint).
+- `rhs` — Rhs region ID from the geobase. [UInt32](../data-types/int-uint).
- `geobase` — Dictionary key. See [Multiple Geobases](#multiple-geobases). [String](../data-types/string). Optional.
**Returned value**
-- 1, if it belongs. [UInt8](../../sql-reference/data-types/int-uint).
+- 1, if it belongs. [UInt8](../data-types/int-uint).
- 0, if it doesn't belong.
**Implementation details**
diff --git a/docs/en/sql-reference/statements/alter/comment.md b/docs/en/sql-reference/statements/alter/comment.md
index f6fb179d969..320828f0de9 100644
--- a/docs/en/sql-reference/statements/alter/comment.md
+++ b/docs/en/sql-reference/statements/alter/comment.md
@@ -4,7 +4,7 @@ sidebar_position: 51
sidebar_label: COMMENT
---
-# ALTER TABLE … MODIFY COMMENT
+# ALTER TABLE ... MODIFY COMMENT
Adds, modifies, or removes comment to the table, regardless if it was set before or not. Comment change is reflected in both [system.tables](../../../operations/system-tables/tables.md) and `SHOW CREATE TABLE` query.
diff --git a/docs/en/sql-reference/statements/alter/delete.md b/docs/en/sql-reference/statements/alter/delete.md
index b6f45b67d52..af56bec7a11 100644
--- a/docs/en/sql-reference/statements/alter/delete.md
+++ b/docs/en/sql-reference/statements/alter/delete.md
@@ -4,7 +4,7 @@ sidebar_position: 39
sidebar_label: DELETE
---
-# ALTER TABLE … DELETE Statement
+# ALTER TABLE ... DELETE Statement
``` sql
ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr
diff --git a/docs/en/sql-reference/statements/alter/index.md b/docs/en/sql-reference/statements/alter/index.md
index 7961315c193..3cfb99cff83 100644
--- a/docs/en/sql-reference/statements/alter/index.md
+++ b/docs/en/sql-reference/statements/alter/index.md
@@ -42,7 +42,7 @@ These `ALTER` statements modify entities related to role-based access control:
## Mutations
-`ALTER` queries that are intended to manipulate table data are implemented with a mechanism called “mutations”, most notably [ALTER TABLE … DELETE](/docs/en/sql-reference/statements/alter/delete.md) and [ALTER TABLE … UPDATE](/docs/en/sql-reference/statements/alter/update.md). They are asynchronous background processes similar to merges in [MergeTree](/docs/en/engines/table-engines/mergetree-family/index.md) tables that to produce new “mutated” versions of parts.
+`ALTER` queries that are intended to manipulate table data are implemented with a mechanism called “mutations”, most notably [ALTER TABLE ... DELETE](/docs/en/sql-reference/statements/alter/delete.md) and [ALTER TABLE ... UPDATE](/docs/en/sql-reference/statements/alter/update.md). They are asynchronous background processes similar to merges in [MergeTree](/docs/en/engines/table-engines/mergetree-family/index.md) tables that to produce new “mutated” versions of parts.
For `*MergeTree` tables mutations execute by **rewriting whole data parts**. There is no atomicity - parts are substituted for mutated parts as soon as they are ready and a `SELECT` query that started executing during a mutation will see data from parts that have already been mutated along with data from parts that have not been mutated yet.
diff --git a/docs/en/sql-reference/statements/alter/update.md b/docs/en/sql-reference/statements/alter/update.md
index ab7d0ca7378..0b300e5849a 100644
--- a/docs/en/sql-reference/statements/alter/update.md
+++ b/docs/en/sql-reference/statements/alter/update.md
@@ -4,7 +4,7 @@ sidebar_position: 40
sidebar_label: UPDATE
---
-# ALTER TABLE … UPDATE Statements
+# ALTER TABLE ... UPDATE Statements
``` sql
ALTER TABLE [db.]table [ON CLUSTER cluster] UPDATE column1 = expr1 [, ...] [IN PARTITION partition_id] WHERE filter_expr
diff --git a/docs/en/sql-reference/statements/alter/view.md b/docs/en/sql-reference/statements/alter/view.md
index e063b27424e..83e8e9311b4 100644
--- a/docs/en/sql-reference/statements/alter/view.md
+++ b/docs/en/sql-reference/statements/alter/view.md
@@ -4,9 +4,9 @@ sidebar_position: 50
sidebar_label: VIEW
---
-# ALTER TABLE … MODIFY QUERY Statement
+# ALTER TABLE ... MODIFY QUERY Statement
-You can modify `SELECT` query that was specified when a [materialized view](../create/view.md#materialized) was created with the `ALTER TABLE … MODIFY QUERY` statement without interrupting ingestion process.
+You can modify `SELECT` query that was specified when a [materialized view](../create/view.md#materialized) was created with the `ALTER TABLE ... MODIFY QUERY` statement without interrupting ingestion process.
This command is created to change materialized view created with `TO [db.]name` clause. It does not change the structure of the underlying storage table and it does not change the columns' definition of the materialized view, because of this the application of this command is very limited for materialized views are created without `TO [db.]name` clause.
@@ -198,6 +198,6 @@ SELECT * FROM mv;
`ALTER LIVE VIEW ... REFRESH` statement refreshes a [Live view](../create/view.md#live-view). See [Force Live View Refresh](../create/view.md#live-view-alter-refresh).
-## ALTER TABLE … MODIFY REFRESH Statement
+## ALTER TABLE ... MODIFY REFRESH Statement
`ALTER TABLE ... MODIFY REFRESH` statement changes refresh parameters of a [Refreshable Materialized View](../create/view.md#refreshable-materialized-view). See [Changing Refresh Parameters](../create/view.md#changing-refresh-parameters).
diff --git a/docs/en/sql-reference/statements/create/view.md b/docs/en/sql-reference/statements/create/view.md
index 073a3c0d246..b526c94e508 100644
--- a/docs/en/sql-reference/statements/create/view.md
+++ b/docs/en/sql-reference/statements/create/view.md
@@ -306,7 +306,7 @@ CREATE WINDOW VIEW test.wv TO test.dst WATERMARK=ASCENDING ALLOWED_LATENESS=INTE
Note that elements emitted by a late firing should be treated as updated results of a previous computation. Instead of firing at the end of windows, the window view will fire immediately when the late event arrives. Thus, it will result in multiple outputs for the same window. Users need to take these duplicated results into account or deduplicate them.
-You can modify `SELECT` query that was specified in the window view by using `ALTER TABLE … MODIFY QUERY` statement. The data structure resulting in a new `SELECT` query should be the same as the original `SELECT` query when with or without `TO [db.]name` clause. Note that the data in the current window will be lost because the intermediate state cannot be reused.
+You can modify `SELECT` query that was specified in the window view by using `ALTER TABLE ... MODIFY QUERY` statement. The data structure resulting in a new `SELECT` query should be the same as the original `SELECT` query when with or without `TO [db.]name` clause. Note that the data in the current window will be lost because the intermediate state cannot be reused.
### Monitoring New Windows
diff --git a/docs/en/sql-reference/statements/insert-into.md b/docs/en/sql-reference/statements/insert-into.md
index a76692cf291..f3dadabd25f 100644
--- a/docs/en/sql-reference/statements/insert-into.md
+++ b/docs/en/sql-reference/statements/insert-into.md
@@ -73,7 +73,7 @@ Data can be passed to the INSERT in any [format](../../interfaces/formats.md#for
INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set
```
-For example, the following query format is identical to the basic version of INSERT … VALUES:
+For example, the following query format is identical to the basic version of INSERT ... VALUES:
``` sql
INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ...
diff --git a/docs/en/sql-reference/statements/select/limit.md b/docs/en/sql-reference/statements/select/limit.md
index d61a5a44b58..58fdf988bf3 100644
--- a/docs/en/sql-reference/statements/select/limit.md
+++ b/docs/en/sql-reference/statements/select/limit.md
@@ -17,11 +17,11 @@ If there is no [ORDER BY](../../../sql-reference/statements/select/order-by.md)
The number of rows in the result set can also depend on the [limit](../../../operations/settings/settings.md#limit) setting.
:::
-## LIMIT … WITH TIES Modifier
+## LIMIT ... WITH TIES Modifier
When you set `WITH TIES` modifier for `LIMIT n[,m]` and specify `ORDER BY expr_list`, you will get in result first `n` or `n,m` rows and all rows with same `ORDER BY` fields values equal to row at position `n` for `LIMIT n` and `m` for `LIMIT n,m`.
-This modifier also can be combined with [ORDER BY … WITH FILL modifier](../../../sql-reference/statements/select/order-by.md#orderby-with-fill).
+This modifier also can be combined with [ORDER BY ... WITH FILL modifier](../../../sql-reference/statements/select/order-by.md#orderby-with-fill).
For example, the following query
diff --git a/docs/en/sql-reference/statements/select/order-by.md b/docs/en/sql-reference/statements/select/order-by.md
index d6432a7b4f8..512a58d7cd9 100644
--- a/docs/en/sql-reference/statements/select/order-by.md
+++ b/docs/en/sql-reference/statements/select/order-by.md
@@ -283,7 +283,7 @@ In `MaterializedView`-engine tables the optimization works with views like `SELE
## ORDER BY Expr WITH FILL Modifier
-This modifier also can be combined with [LIMIT … WITH TIES modifier](../../../sql-reference/statements/select/limit.md#limit-with-ties).
+This modifier also can be combined with [LIMIT ... WITH TIES modifier](../../../sql-reference/statements/select/limit.md#limit-with-ties).
`WITH FILL` modifier can be set after `ORDER BY expr` with optional `FROM expr`, `TO expr` and `STEP expr` parameters.
All missed values of `expr` column will be filled sequentially and other columns will be filled as defaults.
diff --git a/docs/en/sql-reference/table-functions/file.md b/docs/en/sql-reference/table-functions/file.md
index 3a63811add6..f66178afbb2 100644
--- a/docs/en/sql-reference/table-functions/file.md
+++ b/docs/en/sql-reference/table-functions/file.md
@@ -169,7 +169,7 @@ If your listing of files contains number ranges with leading zeros, use the cons
**Example**
-Query the total number of rows in files named `file000`, `file001`, … , `file999`:
+Query the total number of rows in files named `file000`, `file001`, ... , `file999`:
``` sql
SELECT count(*) FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32');
diff --git a/docs/en/sql-reference/table-functions/gcs.md b/docs/en/sql-reference/table-functions/gcs.md
index 80077ecdb33..b891d88df31 100644
--- a/docs/en/sql-reference/table-functions/gcs.md
+++ b/docs/en/sql-reference/table-functions/gcs.md
@@ -130,7 +130,7 @@ FROM gcs('https://storage.googleapis.com/my-test-bucket-768/{some,another}_prefi
If your listing of files contains number ranges with leading zeros, use the construction with braces for each digit separately or use `?`.
:::
-Count the total amount of rows in files named `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
+Count the total amount of rows in files named `file-000.csv`, `file-001.csv`, ... , `file-999.csv`:
``` sql
SELECT count(*)
diff --git a/docs/en/sql-reference/table-functions/hdfs.md b/docs/en/sql-reference/table-functions/hdfs.md
index 92f904b8841..d65615e7588 100644
--- a/docs/en/sql-reference/table-functions/hdfs.md
+++ b/docs/en/sql-reference/table-functions/hdfs.md
@@ -85,7 +85,7 @@ If your listing of files contains number ranges with leading zeros, use the cons
**Example**
-Query the data from files named `file000`, `file001`, … , `file999`:
+Query the data from files named `file000`, `file001`, ... , `file999`:
``` sql
SELECT count(*)
diff --git a/docs/en/sql-reference/table-functions/s3.md b/docs/en/sql-reference/table-functions/s3.md
index 38d77a98749..cbef80371a3 100644
--- a/docs/en/sql-reference/table-functions/s3.md
+++ b/docs/en/sql-reference/table-functions/s3.md
@@ -137,7 +137,7 @@ FROM s3('https://clickhouse-public-datasets.s3.amazonaws.com/my-test-bucket-768/
If your listing of files contains number ranges with leading zeros, use the construction with braces for each digit separately or use `?`.
:::
-Count the total amount of rows in files named `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
+Count the total amount of rows in files named `file-000.csv`, `file-001.csv`, ... , `file-999.csv`:
``` sql
SELECT count(*)
diff --git a/docs/ru/development/style.md b/docs/ru/development/style.md
index 4aa2073d75b..a071d0fb00d 100644
--- a/docs/ru/development/style.md
+++ b/docs/ru/development/style.md
@@ -57,7 +57,7 @@ memcpy(&buf[place_value], &x, sizeof(x));
for (size_t i = 0; i < rows; i += storage.index_granularity)
```
-**7.** Вокруг бинарных операторов (`+`, `-`, `*`, `/`, `%`, …), а также тернарного оператора `?:` ставятся пробелы.
+**7.** Вокруг бинарных операторов (`+`, `-`, `*`, `/`, `%`, ...), а также тернарного оператора `?:` ставятся пробелы.
``` cpp
UInt16 year = (s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
@@ -86,7 +86,7 @@ dst.ClickGoodEvent = click.GoodEvent;
При необходимости, оператор может быть перенесён на новую строку. В этом случае, перед ним увеличивается отступ.
-**11.** Унарные операторы `--`, `++`, `*`, `&`, … не отделяются от аргумента пробелом.
+**11.** Унарные операторы `--`, `++`, `*`, `&`, ... не отделяются от аргумента пробелом.
**12.** После запятой ставится пробел, а перед — нет. Аналогично для точки с запятой внутри выражения `for`.
@@ -115,7 +115,7 @@ public:
**16.** Если на весь файл один `namespace` и кроме него ничего существенного нет, то отступ внутри `namespace` не нужен.
-**17.** Если блок для выражения `if`, `for`, `while`, … состоит из одного `statement`, то фигурные скобки не обязательны. Вместо этого поместите `statement` на отдельную строку. Это правило справедливо и для вложенных `if`, `for`, `while`, …
+**17.** Если блок для выражения `if`, `for`, `while`, ... состоит из одного `statement`, то фигурные скобки не обязательны. Вместо этого поместите `statement` на отдельную строку. Это правило справедливо и для вложенных `if`, `for`, `while`, ...
Если внутренний `statement` содержит фигурные скобки или `else`, то внешний блок следует писать в фигурных скобках.
@@ -266,7 +266,7 @@ void executeQuery(
Пример взят с ресурса http://home.tamk.fi/~jaalto/course/coding-style/doc/unmaintainable-code/.
-**7.** Нельзя писать мусорные комментарии (автор, дата создания…) в начале каждого файла.
+**7.** Нельзя писать мусорные комментарии (автор, дата создания...) в начале каждого файла.
**8.** Однострочные комментарии начинаются с трёх слешей: `///` , многострочные с `/**`. Такие комментарии считаются «документирующими».
diff --git a/docs/ru/engines/table-engines/integrations/hdfs.md b/docs/ru/engines/table-engines/integrations/hdfs.md
index 72087b56652..cf43eef73e3 100644
--- a/docs/ru/engines/table-engines/integrations/hdfs.md
+++ b/docs/ru/engines/table-engines/integrations/hdfs.md
@@ -103,7 +103,7 @@ CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs
**Example**
-Создадим таблицу с именами `file000`, `file001`, … , `file999`:
+Создадим таблицу с именами `file000`, `file001`, ... , `file999`:
``` sql
CREATE TABLE big_table (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV')
diff --git a/docs/ru/engines/table-engines/integrations/s3.md b/docs/ru/engines/table-engines/integrations/s3.md
index 720aa589122..a1c69df4d0a 100644
--- a/docs/ru/engines/table-engines/integrations/s3.md
+++ b/docs/ru/engines/table-engines/integrations/s3.md
@@ -73,7 +73,7 @@ SELECT * FROM s3_engine_table LIMIT 2;
**Пример подстановки 1**
-Таблица содержит данные из файлов с именами `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
+Таблица содержит данные из файлов с именами `file-000.csv`, `file-001.csv`, ... , `file-999.csv`:
``` sql
CREATE TABLE big_table (name String, value UInt32)
diff --git a/docs/ru/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/ru/engines/table-engines/mergetree-family/custom-partitioning-key.md
index 46597c94370..c3203804211 100644
--- a/docs/ru/engines/table-engines/mergetree-family/custom-partitioning-key.md
+++ b/docs/ru/engines/table-engines/mergetree-family/custom-partitioning-key.md
@@ -66,7 +66,7 @@ WHERE table = 'visits'
└───────────┴───────────────────┴────────┘
```
-Столбец `partition` содержит имена всех партиций таблицы. Таблица `visits` из нашего примера содержит две партиции: `201901` и `201902`. Используйте значения из этого столбца в запросах [ALTER … PARTITION](../../../sql-reference/statements/alter/partition.md).
+Столбец `partition` содержит имена всех партиций таблицы. Таблица `visits` из нашего примера содержит две партиции: `201901` и `201902`. Используйте значения из этого столбца в запросах [ALTER ... PARTITION](../../../sql-reference/statements/alter/partition.md).
Столбец `name` содержит названия кусков партиций. Значения из этого столбца можно использовать в запросах [ALTER ATTACH PART](../../../sql-reference/statements/alter/partition.md#alter_attach-partition).
diff --git a/docs/ru/engines/table-engines/mergetree-family/mergetree.md b/docs/ru/engines/table-engines/mergetree-family/mergetree.md
index faa492d4d85..49ba229b1d5 100644
--- a/docs/ru/engines/table-engines/mergetree-family/mergetree.md
+++ b/docs/ru/engines/table-engines/mergetree-family/mergetree.md
@@ -771,7 +771,7 @@ SETTINGS storage_policy = 'moving_from_ssd_to_hdd'
- В результате вставки (запрос `INSERT`).
- В фоновых операциях слияний и [мутаций](../../../sql-reference/statements/alter/index.md#mutations).
- При скачивании данных с другой реплики.
-- В результате заморозки партиций [ALTER TABLE … FREEZE PARTITION](../../../engines/table-engines/mergetree-family/mergetree.md#alter_freeze-partition).
+- В результате заморозки партиций [ALTER TABLE ... FREEZE PARTITION](../../../engines/table-engines/mergetree-family/mergetree.md#alter_freeze-partition).
Во всех случаях, кроме мутаций и заморозки партиций, при записи куска выбирается том и диск в соответствии с указанной конфигурацией хранилища:
@@ -781,7 +781,7 @@ SETTINGS storage_policy = 'moving_from_ssd_to_hdd'
Мутации и запросы заморозки партиций в реализации используют [жесткие ссылки](https://ru.wikipedia.org/wiki/%D0%96%D1%91%D1%81%D1%82%D0%BA%D0%B0%D1%8F_%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B0). Жесткие ссылки между различными дисками не поддерживаются, поэтому в случае таких операций куски размещаются на тех же дисках, что и исходные.
В фоне куски перемещаются между томами на основе информации о занятом месте (настройка `move_factor`) по порядку, в котором указаны тома в конфигурации. Данные никогда не перемещаются с последнего тома и на первый том. Следить за фоновыми перемещениями можно с помощью системных таблиц [system.part_log](../../../engines/table-engines/mergetree-family/mergetree.md#system_tables-part-log) (поле `type = MOVE_PART`) и [system.parts](../../../engines/table-engines/mergetree-family/mergetree.md#system_tables-parts) (поля `path` и `disk`). Также подробная информация о перемещениях доступна в логах сервера.
-С помощью запроса [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../engines/table-engines/mergetree-family/mergetree.md#alter_move-partition) пользователь может принудительно перенести кусок или партицию с одного раздела на другой. При этом учитываются все ограничения, указанные для фоновых операций. Запрос самостоятельно инициирует процесс перемещения не дожидаясь фоновых операций. В случае недостатка места или неудовлетворения ограничениям пользователь получит сообщение об ошибке.
+С помощью запроса [ALTER TABLE ... MOVE PART\|PARTITION ... TO VOLUME\|DISK ...](../../../engines/table-engines/mergetree-family/mergetree.md#alter_move-partition) пользователь может принудительно перенести кусок или партицию с одного раздела на другой. При этом учитываются все ограничения, указанные для фоновых операций. Запрос самостоятельно инициирует процесс перемещения не дожидаясь фоновых операций. В случае недостатка места или неудовлетворения ограничениям пользователь получит сообщение об ошибке.
Перемещения данных не взаимодействуют с репликацией данных, поэтому на разных репликах одной и той же таблицы могут быть указаны разные политики хранения.
diff --git a/docs/ru/engines/table-engines/special/external-data.md b/docs/ru/engines/table-engines/special/external-data.md
index 881566e5f34..3d9737096f5 100644
--- a/docs/ru/engines/table-engines/special/external-data.md
+++ b/docs/ru/engines/table-engines/special/external-data.md
@@ -31,7 +31,7 @@ ClickHouse позволяет отправить на сервер данные,
- **--format** - формат данных в файле. Если не указано - используется TabSeparated.
Должен быть указан один из следующих параметров:
-- **--types** - список типов столбцов через запятую. Например, `UInt64,String`. Столбцы будут названы _1, _2, …
+- **--types** - список типов столбцов через запятую. Например, `UInt64,String`. Столбцы будут названы _1, _2, ...
- **--structure** - структура таблицы, в форме `UserID UInt64`, `URL String`. Определяет имена и типы столбцов.
Файлы, указанные в file, будут разобраны форматом, указанным в format, с использованием типов данных, указанных в types или structure. Таблица будет загружена на сервер, и доступна там в качестве временной таблицы с именем name.
diff --git a/docs/ru/faq/general/olap.md b/docs/ru/faq/general/olap.md
index c9021f7c92e..bcfe9663381 100644
--- a/docs/ru/faq/general/olap.md
+++ b/docs/ru/faq/general/olap.md
@@ -9,13 +9,13 @@ sidebar_position: 100
[OLAP](https://ru.wikipedia.org/wiki/OLAP) (OnLine Analytical Processing) переводится как обработка данных в реальном времени. Это широкий термин, который можно рассмотреть с двух сторон: с технической и с точки зрения бизнеса. Для самого общего понимания можно просто прочитать его с конца:
**Processing**
- Обрабатываются некие исходные данные…
+ Обрабатываются некие исходные данные...
**Analytical**
-: … чтобы получить какие-то аналитические отчеты или новые знания…
+: ... чтобы получить какие-то аналитические отчеты или новые знания...
**OnLine**
-: … в реальном времени, практически без задержек на обработку.
+: ... в реальном времени, практически без задержек на обработку.
## OLAP с точки зрения бизнеса {#olap-from-the-business-perspective}
diff --git a/docs/ru/getting-started/example-datasets/nyc-taxi.md b/docs/ru/getting-started/example-datasets/nyc-taxi.md
index 12d0c18c3a1..a42033e7d41 100644
--- a/docs/ru/getting-started/example-datasets/nyc-taxi.md
+++ b/docs/ru/getting-started/example-datasets/nyc-taxi.md
@@ -196,7 +196,7 @@ real 75m56.214s
(Импорт данных напрямую из Postgres также возможен с использованием `COPY ... TO PROGRAM`.)
-К сожалению, все поля, связанные с погодой (precipitation…average_wind_speed) заполнены NULL. Из-за этого мы исключим их из финального набора данных.
+К сожалению, все поля, связанные с погодой (precipitation...average_wind_speed) заполнены NULL. Из-за этого мы исключим их из финального набора данных.
Для начала мы создадим таблицу на одном сервере. Позже мы сделаем таблицу распределенной.
diff --git a/docs/ru/index.md b/docs/ru/index.md
index 29f2bbe07fb..02be8912b94 100644
--- a/docs/ru/index.md
+++ b/docs/ru/index.md
@@ -12,10 +12,10 @@ ClickHouse — столбцовая система управления база
| Строка | WatchID | JavaEnable | Title | GoodEvent | EventTime |
|--------|-------------|------------|--------------------|-----------|---------------------|
-| #0 | 89354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 |
-| #1 | 90329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 |
-| #2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 |
-| #N | … | … | … | … | … |
+| #0 | 89354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 |
+| #1 | 90329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 |
+| #2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 |
+| #N | ... | ... | ... | ... | ... |
То есть, значения, относящиеся к одной строке, физически хранятся рядом.
@@ -24,13 +24,13 @@ ClickHouse — столбцовая система управления база
В столбцовых СУБД данные хранятся в таком порядке:
-| Строка: | #0 | #1 | #2 | #N |
+| Строка: | #0 | #1 | #2 | #N |
|-------------|---------------------|---------------------|---------------------|-----|
-| WatchID: | 89354350662 | 90329509958 | 89953706054 | … |
-| JavaEnable: | 1 | 0 | 1 | … |
-| Title: | Investor Relations | Contact us | Mission | … |
-| GoodEvent: | 1 | 1 | 1 | … |
-| EventTime: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | … |
+| WatchID: | 89354350662 | 90329509958 | 89953706054 | ... |
+| JavaEnable: | 1 | 0 | 1 | ... |
+| Title: | Investor Relations | Contact us | Mission | ... |
+| GoodEvent: | 1 | 1 | 1 | ... |
+| EventTime: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | ... |
В примерах изображён только порядок расположения данных.
То есть значения из разных столбцов хранятся отдельно, а данные одного столбца — вместе.
diff --git a/docs/ru/interfaces/formats.md b/docs/ru/interfaces/formats.md
index a9280de9c7b..4ed42b6fb22 100644
--- a/docs/ru/interfaces/formats.md
+++ b/docs/ru/interfaces/formats.md
@@ -119,6 +119,7 @@ Hello\nworld
Hello\
world
```
+`\n\r` (CRLF) поддерживается с помощью настройки `input_format_tsv_crlf_end_of_line`.
Второй вариант поддерживается, так как его использует MySQL при записи tab-separated дампа.
diff --git a/docs/ru/operations/settings/query-complexity.md b/docs/ru/operations/settings/query-complexity.md
index d1d38a587c6..e82a5a008eb 100644
--- a/docs/ru/operations/settings/query-complexity.md
+++ b/docs/ru/operations/settings/query-complexity.md
@@ -260,7 +260,7 @@ FORMAT Null;
Ограничивает количество строк в хэш-таблице, используемой при соединении таблиц.
-Параметр применяется к операциям [SELECT… JOIN](../../sql-reference/statements/select/join.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md).
+Параметр применяется к операциям [SELECT... JOIN](../../sql-reference/statements/select/join.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md).
Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата.
@@ -277,7 +277,7 @@ FORMAT Null;
Ограничивает размер (в байтах) хэш-таблицы, используемой при объединении таблиц.
-Параметр применяется к операциям [SELECT… JOIN](../../sql-reference/statements/select/join.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md).
+Параметр применяется к операциям [SELECT... JOIN](../../sql-reference/statements/select/join.md#select-join) и к движку таблиц [Join](../../engines/table-engines/special/join.md).
Если запрос содержит несколько `JOIN`, то ClickHouse проверяет значение настройки для каждого промежуточного результата.
diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md
index 2b3607dcf08..3a70a0bac12 100644
--- a/docs/ru/operations/settings/settings.md
+++ b/docs/ru/operations/settings/settings.md
@@ -1859,7 +1859,7 @@ SELECT * FROM test_table
## count_distinct_implementation {#settings-count_distinct_implementation}
-Задаёт, какая из функций `uniq*` используется при выполнении конструкции [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference/count.md#agg_function-count).
+Задаёт, какая из функций `uniq*` используется при выполнении конструкции [COUNT(DISTINCT ...)](../../sql-reference/aggregate-functions/reference/count.md#agg_function-count).
Возможные значения:
diff --git a/docs/ru/sql-reference/aggregate-functions/parametric-functions.md b/docs/ru/sql-reference/aggregate-functions/parametric-functions.md
index 6463f6bd95d..e6a61d9b381 100644
--- a/docs/ru/sql-reference/aggregate-functions/parametric-functions.md
+++ b/docs/ru/sql-reference/aggregate-functions/parametric-functions.md
@@ -82,7 +82,7 @@ FROM
В этом случае необходимо помнить, что границы корзин гистограммы не известны.
-## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch}
+## sequenceMatch(pattern)(timestamp, cond1, cond2, ...) {#function-sequencematch}
Проверяет, содержит ли последовательность событий цепочку, которая соответствует указанному шаблону.
@@ -172,7 +172,7 @@ SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM
- [sequenceCount](#function-sequencecount)
-## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount}
+## sequenceCount(pattern)(time, cond1, cond2, ...) {#function-sequencecount}
Вычисляет количество цепочек событий, соответствующих шаблону. Функция обнаруживает только непересекающиеся цепочки событий. Она начинает искать следующую цепочку только после того, как полностью совпала текущая цепочка событий.
diff --git a/docs/ru/sql-reference/aggregate-functions/reference/quantiles.md b/docs/ru/sql-reference/aggregate-functions/reference/quantiles.md
index fed0f8b328b..a0a430f7a68 100644
--- a/docs/ru/sql-reference/aggregate-functions/reference/quantiles.md
+++ b/docs/ru/sql-reference/aggregate-functions/reference/quantiles.md
@@ -7,7 +7,7 @@ sidebar_position: 201
## quantiles {#quantiles}
-Синтаксис: `quantiles(level1, level2, …)(x)`
+Синтаксис: `quantiles(level1, level2, ...)(x)`
Все функции для вычисления квантилей имеют соответствующие функции для вычисления нескольких квантилей: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`, `quantilesBFloat16`. Эти функции вычисляют все квантили указанных уровней в один проход и возвращают массив с вычисленными значениями.
diff --git a/docs/ru/sql-reference/data-types/aggregatefunction.md b/docs/ru/sql-reference/data-types/aggregatefunction.md
index e42b467e4af..0481151c7e4 100644
--- a/docs/ru/sql-reference/data-types/aggregatefunction.md
+++ b/docs/ru/sql-reference/data-types/aggregatefunction.md
@@ -6,9 +6,9 @@ sidebar_label: AggregateFunction
# AggregateFunction {#data-type-aggregatefunction}
-Агрегатные функции могут обладать определяемым реализацией промежуточным состоянием, которое может быть сериализовано в тип данных, соответствующий AggregateFunction(…), и быть записано в таблицу обычно посредством [материализованного представления](../../sql-reference/statements/create/view.md). Чтобы получить промежуточное состояние, обычно используются агрегатные функции с суффиксом `-State`. Чтобы в дальнейшем получить агрегированные данные необходимо использовать те же агрегатные функции с суффиксом `-Merge`.
+Агрегатные функции могут обладать определяемым реализацией промежуточным состоянием, которое может быть сериализовано в тип данных, соответствующий AggregateFunction(...), и быть записано в таблицу обычно посредством [материализованного представления](../../sql-reference/statements/create/view.md). Чтобы получить промежуточное состояние, обычно используются агрегатные функции с суффиксом `-State`. Чтобы в дальнейшем получить агрегированные данные необходимо использовать те же агрегатные функции с суффиксом `-Merge`.
-`AggregateFunction(name, types_of_arguments…)` — параметрический тип данных.
+`AggregateFunction(name, types_of_arguments...)` — параметрический тип данных.
**Параметры**
diff --git a/docs/ru/sql-reference/data-types/fixedstring.md b/docs/ru/sql-reference/data-types/fixedstring.md
index d7a4e865903..56a5632f88d 100644
--- a/docs/ru/sql-reference/data-types/fixedstring.md
+++ b/docs/ru/sql-reference/data-types/fixedstring.md
@@ -21,8 +21,8 @@ sidebar_label: FixedString(N)
Примеры значений, которые можно эффективно хранить в столбцах типа `FixedString`:
- Двоичное представление IP-адреса (`FixedString(16)` для IPv6).
-- Коды языков (ru_RU, en_US … ).
-- Коды валют (USD, RUB … ).
+- Коды языков (ru_RU, en_US ... ).
+- Коды валют (USD, RUB ... ).
- Двоичное представление хэшей (`FixedString(16)` для MD5, `FixedString(32)` для SHA256).
Для хранения значений UUID используйте тип данных [UUID](uuid.md).
diff --git a/docs/ru/sql-reference/data-types/nested-data-structures/nested.md b/docs/ru/sql-reference/data-types/nested-data-structures/nested.md
index 4ec8333d563..8fd293a0415 100644
--- a/docs/ru/sql-reference/data-types/nested-data-structures/nested.md
+++ b/docs/ru/sql-reference/data-types/nested-data-structures/nested.md
@@ -3,7 +3,7 @@ slug: /ru/sql-reference/data-types/nested-data-structures/nested
---
# Nested {#nested}
-## Nested(Name1 Type1, Name2 Type2, …) {#nestedname1-type1-name2-type2}
+## Nested(Name1 Type1, Name2 Type2, ...) {#nestedname1-type1-name2-type2}
Вложенная структура данных - это как будто вложенная таблица. Параметры вложенной структуры данных - имена и типы столбцов, указываются так же, как у запроса CREATE. Каждой строке таблицы может соответствовать произвольное количество строк вложенной структуры данных.
diff --git a/docs/ru/sql-reference/data-types/tuple.md b/docs/ru/sql-reference/data-types/tuple.md
index 8953134d154..9d86c26c563 100644
--- a/docs/ru/sql-reference/data-types/tuple.md
+++ b/docs/ru/sql-reference/data-types/tuple.md
@@ -4,7 +4,7 @@ sidebar_position: 54
sidebar_label: Tuple(T1, T2, ...)
---
-# Tuple(T1, T2, …) {#tuplet1-t2}
+# Tuple(T1, T2, ...) {#tuplet1-t2}
Кортеж из элементов любого [типа](index.md#data_types). Элементы кортежа могут быть одного или разных типов.
diff --git a/docs/ru/sql-reference/functions/array-functions.md b/docs/ru/sql-reference/functions/array-functions.md
index 1f06bdf264a..825e3f06be2 100644
--- a/docs/ru/sql-reference/functions/array-functions.md
+++ b/docs/ru/sql-reference/functions/array-functions.md
@@ -161,7 +161,7 @@ SELECT range(5), range(1, 5), range(1, 5, 2);
```
-## array(x1, …), оператор \[x1, …\] {#arrayx1-operator-x1}
+## array(x1, ...), оператор \[x1, ...\] {#arrayx1-operator-x1}
Создаёт массив из аргументов функции.
Аргументы должны быть константами и иметь типы, для которых есть наименьший общий тип. Должен быть передан хотя бы один аргумент, так как иначе непонятно, какого типа создавать массив. То есть, с помощью этой функции невозможно создать пустой массив (для этого используйте функции emptyArray\*, описанные выше).
@@ -308,7 +308,7 @@ SELECT indexOf([1, 3, NULL, NULL], NULL)
Элементы, равные `NULL`, обрабатываются как обычные значения.
-## arrayCount(\[func,\] arr1, …) {#array-count}
+## arrayCount(\[func,\] arr1, ...) {#array-count}
Возвращает количество элементов массива `arr`, для которых функция `func` возвращает не 0. Если `func` не указана - возвращает количество ненулевых элементов массива.
@@ -335,7 +335,7 @@ SELECT countEqual([1, 2, NULL, NULL], NULL)
## arrayEnumerate(arr) {#array_functions-arrayenumerate}
-Возвращает массив \[1, 2, 3, …, length(arr)\]
+Возвращает массив \[1, 2, 3, ..., length(arr)\]
Эта функция обычно используется совместно с ARRAY JOIN. Она позволяет, после применения ARRAY JOIN, посчитать что-либо только один раз для каждого массива. Пример:
@@ -375,7 +375,7 @@ WHERE (CounterID = 160656) AND notEmpty(GoalsReached)
Также эта функция может быть использована в функциях высшего порядка. Например, с её помощью можно достать индексы массива для элементов, удовлетворяющих некоторому условию.
-## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr}
+## arrayEnumerateUniq(arr, ...) {#arrayenumerateuniqarr}
Возвращает массив, такого же размера, как исходный, где для каждого элемента указано, какой он по счету среди элементов с таким же значением.
Например: arrayEnumerateUniq(\[10, 20, 10, 30\]) = \[1, 1, 2, 1\].
@@ -597,7 +597,7 @@ SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res;
Элементы массива равные `NULL` обрабатываются как обычные значения.
-## arraySort(\[func,\] arr, …) {#array_functions-sort}
+## arraySort(\[func,\] arr, ...) {#array_functions-sort}
Возвращает массив `arr`, отсортированный в восходящем порядке. Если задана функция `func`, то порядок сортировки определяется результатом применения этой функции на элементы массива `arr`. Если `func` принимает несколько аргументов, то в функцию `arraySort` нужно передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания `arraySort`.
@@ -698,11 +698,11 @@ SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res;
Для улучшения эффективности сортировки применяется [преобразование Шварца](https://ru.wikipedia.org/wiki/%D0%9F%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D0%A8%D0%B2%D0%B0%D1%80%D1%86%D0%B0).
:::
-## arrayPartialSort(\[func,\] limit, arr, …) {#array_functions-sort}
+## arrayPartialSort(\[func,\] limit, arr, ...) {#array_functions-sort}
То же, что и `arraySort` с дополнительным аргументом `limit`, позволяющим частичную сортировку. Возвращает массив того же размера, как и исходный, в котором элементы `[1..limit]` отсортированы в возрастающем порядке. Остальные элементы `(limit..N]` остаются в неспецифицированном порядке.
-## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort}
+## arrayReverseSort(\[func,\] arr, ...) {#array_functions-reverse-sort}
Возвращает массив `arr`, отсортированный в нисходящем порядке. Если указана функция `func`, то массив `arr` сначала сортируется в порядке, который определяется функцией `func`, а затем отсортированный массив переворачивается. Если функция `func` принимает несколько аргументов, то в функцию `arrayReverseSort` необходимо передавать несколько массивов, которые будут соответствовать аргументам функции `func`. Подробные примеры рассмотрены в конце описания функции `arrayReverseSort`.
@@ -803,11 +803,11 @@ SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res;
└─────────┘
```
-## arrayPartialReverseSort(\[func,\] limit, arr, …) {#array_functions-sort}
+## arrayPartialReverseSort(\[func,\] limit, arr, ...) {#array_functions-sort}
То же, что и `arrayReverseSort` с дополнительным аргументом `limit`, позволяющим частичную сортировку. Возвращает массив того же размера, как и исходный, в котором элементы `[1..limit]` отсортированы в убывающем порядке. Остальные элементы `(limit..N]` остаются в неспецифицированном порядке.
-## arrayUniq(arr, …) {#array-functions-arrayuniq}
+## arrayUniq(arr, ...) {#array-functions-arrayuniq}
Если передан один аргумент, считает количество разных элементов в массиве.
Если передано несколько аргументов, считает количество разных кортежей из элементов на соответствующих позициях в нескольких массивах.
@@ -1174,7 +1174,7 @@ SELECT arrayZip(['a', 'b', 'c'], [5, 2, 1]);
└──────────────────────────────────────┘
```
-## arrayMap(func, arr1, …) {#array-map}
+## arrayMap(func, arr1, ...) {#array-map}
Возвращает массив, полученный на основе результатов применения функции `func` к каждому элементу массива `arr`.
@@ -1204,7 +1204,7 @@ SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res;
Функция `arrayMap` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayFilter(func, arr1, …) {#array-filter}
+## arrayFilter(func, arr1, ...) {#array-filter}
Возвращает массив, содержащий только те элементы массива `arr1`, для которых функция `func` возвращает не 0.
@@ -1237,7 +1237,7 @@ SELECT
Функция `arrayFilter` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayFill(func, arr1, …) {#array-fill}
+## arrayFill(func, arr1, ...) {#array-fill}
Перебирает `arr1` от первого элемента к последнему и заменяет `arr1[i]` на `arr1[i - 1]`, если `func` вернула 0. Первый элемент `arr1` остаётся неизменным.
@@ -1255,7 +1255,7 @@ SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14,
Функция `arrayFill` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayReverseFill(func, arr1, …) {#array-reverse-fill}
+## arrayReverseFill(func, arr1, ...) {#array-reverse-fill}
Перебирает `arr1` от последнего элемента к первому и заменяет `arr1[i]` на `arr1[i + 1]`, если `func` вернула 0. Последний элемент `arr1` остаётся неизменным.
@@ -1273,7 +1273,7 @@ SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5,
Функция `arrayReverseFill` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arraySplit(func, arr1, …) {#array-split}
+## arraySplit(func, arr1, ...) {#array-split}
Разделяет массив `arr1` на несколько. Если `func` возвращает не 0, то массив разделяется, а элемент помещается в левую часть. Массив не разбивается по первому элементу.
@@ -1291,7 +1291,7 @@ SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
Функция `arraySplit` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayReverseSplit(func, arr1, …) {#array-reverse-split}
+## arrayReverseSplit(func, arr1, ...) {#array-reverse-split}
Разделяет массив `arr1` на несколько. Если `func` возвращает не 0, то массив разделяется, а элемент помещается в правую часть. Массив не разбивается по последнему элементу.
@@ -1309,25 +1309,25 @@ SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
Функция `arrayReverseSplit` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1}
+## arrayExists(\[func,\] arr1, ...) {#arrayexistsfunc-arr1}
Возвращает 1, если существует хотя бы один элемент массива `arr`, для которого функция func возвращает не 0. Иначе возвращает 0.
Функция `arrayExists` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) - в качестве первого аргумента ей можно передать лямбда-функцию.
-## arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1}
+## arrayAll(\[func,\] arr1, ...) {#arrayallfunc-arr1}
Возвращает 1, если для всех элементов массива `arr`, функция `func` возвращает не 0. Иначе возвращает 0.
Функция `arrayAll` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) - в качестве первого аргумента ей можно передать лямбда-функцию.
-## arrayFirst(func, arr1, …) {#array-first}
+## arrayFirst(func, arr1, ...) {#array-first}
Возвращает первый элемент массива `arr1`, для которого функция func возвращает не 0.
Функция `arrayFirst` является [функцией высшего порядка](../../sql-reference/functions/index.md#higher-order-functions) — в качестве первого аргумента ей нужно передать лямбда-функцию, и этот аргумент не может быть опущен.
-## arrayFirstIndex(func, arr1, …) {#array-first-index}
+## arrayFirstIndex(func, arr1, ...) {#array-first-index}
Возвращает индекс первого элемента массива `arr1`, для которого функция func возвращает не 0.
@@ -1599,7 +1599,7 @@ SELECT arraySum(x -> x*x, [2, 3]) AS res;
└─────┘
```
-## arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1}
+## arrayCumSum(\[func,\] arr1, ...) {#arraycumsumfunc-arr1}
Возвращает массив из частичных сумм элементов исходного массива (сумма с накоплением). Если указана функция `func`, то значения элементов массива преобразуются этой функцией перед суммированием.
diff --git a/docs/ru/sql-reference/functions/date-time-functions.md b/docs/ru/sql-reference/functions/date-time-functions.md
index 56ae4359bf1..bcc5f807c32 100644
--- a/docs/ru/sql-reference/functions/date-time-functions.md
+++ b/docs/ru/sql-reference/functions/date-time-functions.md
@@ -559,7 +559,7 @@ SELECT
Описание режимов (mode):
-| Mode | Первый день недели | Диапазон | Неделя 1 это первая неделя … |
+| Mode | Первый день недели | Диапазон | Неделя 1 это первая неделя ... |
| ----------- | -------- | -------- | ------------------ |
|0|Воскресенье|0-53|с воскресеньем в этом году
|1|Понедельник|0-53|с 4-мя или более днями в этом году
diff --git a/docs/ru/sql-reference/functions/json-functions.md b/docs/ru/sql-reference/functions/json-functions.md
index 123f40ce05d..18f625bf80f 100644
--- a/docs/ru/sql-reference/functions/json-functions.md
+++ b/docs/ru/sql-reference/functions/json-functions.md
@@ -88,7 +88,7 @@ SELECT isValidJSON('{"a": "hello", "b": [-100, 200.0, 300]}') = 1
SELECT isValidJSON('not a json') = 0
```
-## JSONHas(json\[, indices_or_keys\]…) {#jsonhasjson-indices-or-keys}
+## JSONHas(json\[, indices_or_keys\]...) {#jsonhasjson-indices-or-keys}
Если значение существует в документе JSON, то возвращается `1`.
@@ -121,7 +121,7 @@ SELECT JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -2) = 'a'
SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'hello'
```
-## JSONLength(json\[, indices_or_keys\]…) {#jsonlengthjson-indices-or-keys}
+## JSONLength(json\[, indices_or_keys\]...) {#jsonlengthjson-indices-or-keys}
Возвращает длину массива JSON или объекта JSON.
@@ -134,7 +134,7 @@ SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 3
SELECT JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}') = 2
```
-## JSONType(json\[, indices_or_keys\]…) {#jsontypejson-indices-or-keys}
+## JSONType(json\[, indices_or_keys\]...) {#jsontypejson-indices-or-keys}
Возвращает тип значения JSON.
@@ -148,13 +148,13 @@ SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'String'
SELECT JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 'Array'
```
-## JSONExtractUInt(json\[, indices_or_keys\]…) {#jsonextractuintjson-indices-or-keys}
+## JSONExtractUInt(json\[, indices_or_keys\]...) {#jsonextractuintjson-indices-or-keys}
-## JSONExtractInt(json\[, indices_or_keys\]…) {#jsonextractintjson-indices-or-keys}
+## JSONExtractInt(json\[, indices_or_keys\]...) {#jsonextractintjson-indices-or-keys}
-## JSONExtractFloat(json\[, indices_or_keys\]…) {#jsonextractfloatjson-indices-or-keys}
+## JSONExtractFloat(json\[, indices_or_keys\]...) {#jsonextractfloatjson-indices-or-keys}
-## JSONExtractBool(json\[, indices_or_keys\]…) {#jsonextractbooljson-indices-or-keys}
+## JSONExtractBool(json\[, indices_or_keys\]...) {#jsonextractbooljson-indices-or-keys}
Парсит JSON и извлекает значение. Эти функции аналогичны функциям `visitParam`.
@@ -168,7 +168,7 @@ SELECT JSONExtractFloat('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 2) = 200
SELECT JSONExtractUInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', -1) = 300
```
-## JSONExtractString(json\[, indices_or_keys\]…) {#jsonextractstringjson-indices-or-keys}
+## JSONExtractString(json\[, indices_or_keys\]...) {#jsonextractstringjson-indices-or-keys}
Парсит JSON и извлекает строку. Эта функция аналогична функции `visitParamExtractString`.
@@ -186,7 +186,7 @@ SELECT JSONExtractString('{"abc":"\\u263"}', 'abc') = ''
SELECT JSONExtractString('{"abc":"hello}', 'abc') = ''
```
-## JSONExtract(json\[, indices_or_keys…\], Return_type) {#jsonextractjson-indices-or-keys-return-type}
+## JSONExtract(json\[, indices_or_keys...\], Return_type) {#jsonextractjson-indices-or-keys-return-type}
Парсит JSON и извлекает значение с заданным типом данных.
@@ -207,7 +207,7 @@ SELECT JSONExtract('{"day": "Thursday"}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday
SELECT JSONExtract('{"day": 5}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday\' = 1, \'Tuesday\' = 2, \'Wednesday\' = 3, \'Thursday\' = 4, \'Friday\' = 5, \'Saturday\' = 6)') = 'Friday'
```
-## JSONExtractKeysAndValues(json\[, indices_or_keys…\], Value_type) {#jsonextractkeysandvaluesjson-indices-or-keys-value-type}
+## JSONExtractKeysAndValues(json\[, indices_or_keys...\], Value_type) {#jsonextractkeysandvaluesjson-indices-or-keys-value-type}
Разбор пар ключ-значение из JSON, где значение имеет тип данных ClickHouse.
@@ -255,7 +255,7 @@ text
└────────────────────────────────────────────────────────────┘
```
-## JSONExtractRaw(json\[, indices_or_keys\]…) {#jsonextractrawjson-indices-or-keys}
+## JSONExtractRaw(json\[, indices_or_keys\]...) {#jsonextractrawjson-indices-or-keys}
Возвращает часть JSON в виде строки, содержащей неразобранную подстроку.
@@ -267,7 +267,7 @@ text
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = '[-100, 200.0, 300]';
```
-## JSONExtractArrayRaw(json\[, indices_or_keys\]…) {#jsonextractarrayrawjson-indices-or-keys}
+## JSONExtractArrayRaw(json\[, indices_or_keys\]...) {#jsonextractarrayrawjson-indices-or-keys}
Возвращает массив из элементов JSON массива, каждый из которых представлен в виде строки с неразобранными подстроками из JSON.
diff --git a/docs/ru/sql-reference/functions/other-functions.md b/docs/ru/sql-reference/functions/other-functions.md
index 835aed934d5..f7637cfa3f7 100644
--- a/docs/ru/sql-reference/functions/other-functions.md
+++ b/docs/ru/sql-reference/functions/other-functions.md
@@ -286,7 +286,7 @@ SELECT byteSize(NULL, 1, 0.3, '');
Превращает константу в полноценный столбец, содержащий только одно значение.
В ClickHouse полноценные столбцы и константы представлены в памяти по-разному. Функции по-разному работают для аргументов-констант и обычных аргументов (выполняется разный код), хотя результат почти всегда должен быть одинаковым. Эта функция предназначена для отладки такого поведения.
-## ignore(…) {#ignore}
+## ignore(...) {#ignore}
Принимает любые аргументы, в т.ч. `NULL`, всегда возвращает 0.
При этом, аргумент всё равно вычисляется. Это может использоваться для бенчмарков.
diff --git a/docs/ru/sql-reference/functions/string-functions.md b/docs/ru/sql-reference/functions/string-functions.md
index eeb5752c626..fc258f7b4cf 100644
--- a/docs/ru/sql-reference/functions/string-functions.md
+++ b/docs/ru/sql-reference/functions/string-functions.md
@@ -358,7 +358,7 @@ SELECT repeat('abc', 10);
Разворачивает последовательность кодовых точек Unicode, при допущении, что строка содержит набор байтов, представляющий текст в кодировке UTF-8. Иначе — что-то делает (не кидает исключение).
-## format(pattern, s0, s1, …) {#format}
+## format(pattern, s0, s1, ...) {#format}
Форматирует константный шаблон со строками, перечисленными в аргументах. `pattern` — упрощенная версия шаблона в языке Python. Шаблон содержит «заменяющие поля», которые окружены фигурными скобками `{}`. Всё, что не содержится в скобках, интерпретируется как обычный текст и просто копируется. Если нужно использовать символ фигурной скобки, можно экранировать двойной скобкой `{{ '{{' }}` или `{{ '}}' }}`. Имя полей могут быть числами (нумерация с нуля) или пустыми (тогда они интерпретируются как последовательные числа).
diff --git a/docs/ru/sql-reference/functions/string-search-functions.md b/docs/ru/sql-reference/functions/string-search-functions.md
index 4f9ae4428a4..53da9a6e791 100644
--- a/docs/ru/sql-reference/functions/string-search-functions.md
+++ b/docs/ru/sql-reference/functions/string-search-functions.md
@@ -311,19 +311,19 @@ Result:
Смотрите `multiSearchAllPositions`.
-## multiSearchFirstPosition(haystack, \[needle1, needle2, …, needlen\]) {#multisearchfirstpositionhaystack-needle1-needle2-needlen}
+## multiSearchFirstPosition(haystack, \[needle1, needle2, ..., needlen\]) {#multisearchfirstpositionhaystack-needle1-needle2-needlen}
Так же, как и `position`, только возвращает оффсет первого вхождения любого из needles.
Для поиска без учета регистра и/или в кодировке UTF-8 используйте функции `multiSearchFirstPositionCaseInsensitive, multiSearchFirstPositionUTF8, multiSearchFirstPositionCaseInsensitiveUTF8`.
-## multiSearchFirstIndex(haystack, \[needle1, needle2, …, needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen}
+## multiSearchFirstIndex(haystack, \[needle1, needle2, ..., needlen\]) {#multisearchfirstindexhaystack-needle1-needle2-needlen}
Возвращает индекс `i` (нумерация с единицы) первой найденной строки needlei в строке `haystack` и 0 иначе.
Для поиска без учета регистра и/или в кодировке UTF-8 используйте функции `multiSearchFirstIndexCaseInsensitive, multiSearchFirstIndexUTF8, multiSearchFirstIndexCaseInsensitiveUTF8`.
-## multiSearchAny(haystack, \[needle1, needle2, …, needlen\]) {#function-multisearchany}
+## multiSearchAny(haystack, \[needle1, needle2, ..., needlen\]) {#function-multisearchany}
Возвращает 1, если хотя бы одна подстрока needlei нашлась в строке `haystack` и 0 иначе.
@@ -343,30 +343,30 @@ Result:
Регулярное выражение работает со строкой как с набором байт. Регулярное выражение не может содержать нулевые байты.
Для шаблонов на поиск подстроки в строке, лучше используйте LIKE или position, так как они работают существенно быстрее.
-## multiMatchAny(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn}
+## multiMatchAny(haystack, \[pattern1, pattern2, ..., patternn\]) {#multimatchanyhaystack-pattern1-pattern2-patternn}
То же, что и `match`, но возвращает ноль, если ни одно регулярное выражение не подошло и один, если хотя бы одно. Используется библиотека [hyperscan](https://github.com/intel/hyperscan) для соответствия регулярных выражений. Для шаблонов на поиск многих подстрок в строке, лучше используйте `multiSearchAny`, так как она работает существенно быстрее.
:::note Примечание
Длина любой строки из `haystack` должна быть меньше 232 байт, иначе бросается исключение. Это ограничение связано с ограничением hyperscan API.
:::
-## multiMatchAnyIndex(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn}
+## multiMatchAnyIndex(haystack, \[pattern1, pattern2, ..., patternn\]) {#multimatchanyindexhaystack-pattern1-pattern2-patternn}
То же, что и `multiMatchAny`, только возвращает любой индекс подходящего регулярного выражения.
-## multiMatchAllIndices(haystack, \[pattern1, pattern2, …, patternn\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn}
+## multiMatchAllIndices(haystack, \[pattern1, pattern2, ..., patternn\]) {#multimatchallindiceshaystack-pattern1-pattern2-patternn}
То же, что и `multiMatchAny`, только возвращает массив всех индексов всех подходящих регулярных выражений в любом порядке.
-## multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn}
+## multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, ..., patternn\]) {#multifuzzymatchanyhaystack-distance-pattern1-pattern2-patternn}
То же, что и `multiMatchAny`, но возвращает 1 если любой шаблон соответствует haystack в пределах константного [редакционного расстояния](https://en.wikipedia.org/wiki/Edit_distance). Эта функция основана на экспериментальной библиотеке [hyperscan](https://intel.github.io/hyperscan/dev-reference/compilation.html#approximate-matching) и может быть медленной для некоторых частных случаев. Производительность зависит от значения редакционного расстояния и используемых шаблонов, но всегда медленнее по сравнению с non-fuzzy вариантами.
-## multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn}
+## multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, ..., patternn\]) {#multifuzzymatchanyindexhaystack-distance-pattern1-pattern2-patternn}
То же, что и `multiFuzzyMatchAny`, только возвращает любой индекс подходящего регулярного выражения в пределах константного редакционного расстояния.
-## multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, …, patternn\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn}
+## multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, ..., patternn\]) {#multifuzzymatchallindiceshaystack-distance-pattern1-pattern2-patternn}
То же, что и `multiFuzzyMatchAny`, только возвращает массив всех индексов всех подходящих регулярных выражений в любом порядке в пределах константного редакционного расстояния.
diff --git a/docs/ru/sql-reference/functions/tuple-functions.md b/docs/ru/sql-reference/functions/tuple-functions.md
index c702e5d00b1..70ae44aa627 100644
--- a/docs/ru/sql-reference/functions/tuple-functions.md
+++ b/docs/ru/sql-reference/functions/tuple-functions.md
@@ -9,15 +9,15 @@ sidebar_label: Функции для работы с кортежами
## tuple {#tuple}
Функция, позволяющая сгруппировать несколько столбцов.
-Для столбцов, имеющих типы T1, T2, … возвращает кортеж типа Tuple(T1, T2, …), содержащий эти столбцы. Выполнение функции ничего не стоит.
+Для столбцов, имеющих типы T1, T2, ... возвращает кортеж типа Tuple(T1, T2, ...), содержащий эти столбцы. Выполнение функции ничего не стоит.
Кортежи обычно используются как промежуточное значение в качестве аргумента операторов IN, или для создания списка формальных параметров лямбда-функций. Кортежи не могут быть записаны в таблицу.
-С помощью функции реализуется оператор `(x, y, …)`.
+С помощью функции реализуется оператор `(x, y, ...)`.
**Синтаксис**
``` sql
-tuple(x, y, …)
+tuple(x, y, ...)
```
## tupleElement {#tupleelement}
diff --git a/docs/ru/sql-reference/functions/url-functions.md b/docs/ru/sql-reference/functions/url-functions.md
index 3c6e6151ef8..087891f4347 100644
--- a/docs/ru/sql-reference/functions/url-functions.md
+++ b/docs/ru/sql-reference/functions/url-functions.md
@@ -14,7 +14,7 @@ sidebar_label: "Функции для работы с URL"
### protocol {#protocol}
-Возвращает протокол. Примеры: http, ftp, mailto, magnet…
+Возвращает протокол. Примеры: http, ftp, mailto, magnet...
### domain {#domain}
diff --git a/docs/ru/sql-reference/statements/alter/comment.md b/docs/ru/sql-reference/statements/alter/comment.md
index 727af15d03e..f841c8540f3 100644
--- a/docs/ru/sql-reference/statements/alter/comment.md
+++ b/docs/ru/sql-reference/statements/alter/comment.md
@@ -4,7 +4,7 @@ sidebar_position: 51
sidebar_label: COMMENT
---
-# ALTER TABLE … MODIFY COMMENT {#alter-modify-comment}
+# ALTER TABLE ... MODIFY COMMENT {#alter-modify-comment}
Добавляет, изменяет или удаляет комментарий к таблице, независимо от того, был ли он установлен раньше или нет. Изменение комментария отражается как в системной таблице [system.tables](../../../operations/system-tables/tables.md), так и в результате выполнения запроса `SHOW CREATE TABLE`.
diff --git a/docs/ru/sql-reference/statements/alter/delete.md b/docs/ru/sql-reference/statements/alter/delete.md
index dc968a17349..c91a79f5cdd 100644
--- a/docs/ru/sql-reference/statements/alter/delete.md
+++ b/docs/ru/sql-reference/statements/alter/delete.md
@@ -4,7 +4,7 @@ sidebar_position: 39
sidebar_label: DELETE
---
-# ALTER TABLE … DELETE {#alter-mutations}
+# ALTER TABLE ... DELETE {#alter-mutations}
``` sql
ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr
diff --git a/docs/ru/sql-reference/statements/alter/index.md b/docs/ru/sql-reference/statements/alter/index.md
index 07f5ff0a298..e8b8af39e11 100644
--- a/docs/ru/sql-reference/statements/alter/index.md
+++ b/docs/ru/sql-reference/statements/alter/index.md
@@ -46,7 +46,7 @@ ALTER TABLE [db].name [ON CLUSTER cluster] ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN
### Мутации {#mutations}
-Мутации - разновидность запроса ALTER, позволяющая изменять или удалять данные в таблице. В отличие от стандартных запросов [ALTER TABLE … DELETE](../../../sql-reference/statements/alter/delete.md) и [ALTER TABLE … UPDATE](../../../sql-reference/statements/alter/update.md), рассчитанных на точечное изменение данных, область применения мутаций - достаточно тяжёлые изменения, затрагивающие много строк в таблице. Поддержана для движков таблиц семейства [MergeTree](../../../engines/table-engines/mergetree-family/mergetree.md), в том числе для движков с репликацией.
+Мутации - разновидность запроса ALTER, позволяющая изменять или удалять данные в таблице. В отличие от стандартных запросов [ALTER TABLE ... DELETE](../../../sql-reference/statements/alter/delete.md) и [ALTER TABLE ... UPDATE](../../../sql-reference/statements/alter/update.md), рассчитанных на точечное изменение данных, область применения мутаций - достаточно тяжёлые изменения, затрагивающие много строк в таблице. Поддержана для движков таблиц семейства [MergeTree](../../../engines/table-engines/mergetree-family/mergetree.md), в том числе для движков с репликацией.
Конвертировать существующие таблицы для работы с мутациями не нужно. Но после применения первой мутации формат данных таблицы становится несовместимым с предыдущими версиями и откатиться на предыдущую версию уже не получится.
diff --git a/docs/ru/sql-reference/statements/alter/update.md b/docs/ru/sql-reference/statements/alter/update.md
index b2032ac77d1..01574a8a9b7 100644
--- a/docs/ru/sql-reference/statements/alter/update.md
+++ b/docs/ru/sql-reference/statements/alter/update.md
@@ -4,7 +4,7 @@ sidebar_position: 40
sidebar_label: UPDATE
---
-# ALTER TABLE … UPDATE {#alter-table-update-statements}
+# ALTER TABLE ... UPDATE {#alter-table-update-statements}
``` sql
ALTER TABLE [db.]table [ON CLUSTER cluster] UPDATE column1 = expr1 [, ...] WHERE filter_expr
diff --git a/docs/ru/sql-reference/statements/alter/view.md b/docs/ru/sql-reference/statements/alter/view.md
index e6f6730ff99..53e295f6bbe 100644
--- a/docs/ru/sql-reference/statements/alter/view.md
+++ b/docs/ru/sql-reference/statements/alter/view.md
@@ -4,9 +4,9 @@ sidebar_position: 50
sidebar_label: VIEW
---
-# Выражение ALTER TABLE … MODIFY QUERY {#alter-modify-query}
+# Выражение ALTER TABLE ... MODIFY QUERY {#alter-modify-query}
-Вы можете изменить запрос `SELECT`, который был задан при создании [материализованного представления](../create/view.md#materialized), с помощью запроса 'ALTER TABLE … MODIFY QUERY'. Используйте его если при создании материализованного представления не использовалась секция `TO [db.]name`. Настройка `allow_experimental_alter_materialized_view_structure` должна быть включена.
+Вы можете изменить запрос `SELECT`, который был задан при создании [материализованного представления](../create/view.md#materialized), с помощью запроса 'ALTER TABLE ... MODIFY QUERY'. Используйте его если при создании материализованного представления не использовалась секция `TO [db.]name`. Настройка `allow_experimental_alter_materialized_view_structure` должна быть включена.
Если при создании материализованного представления использовалась конструкция `TO [db.]name`, то для изменения отсоедините представление с помощью [DETACH](../detach.md), измените таблицу с помощью [ALTER TABLE](index.md), а затем снова присоедините запрос с помощью [ATTACH](../attach.md).
diff --git a/docs/ru/sql-reference/statements/create/view.md b/docs/ru/sql-reference/statements/create/view.md
index 032bdc6e6d4..8fa30446bb3 100644
--- a/docs/ru/sql-reference/statements/create/view.md
+++ b/docs/ru/sql-reference/statements/create/view.md
@@ -60,7 +60,7 @@ AS SELECT ...
Если указано `POPULATE`, то при создании представления в него будут добавлены данные, уже содержащиеся в исходной таблице, как если бы был сделан запрос `CREATE TABLE ... AS SELECT ...` . Если `POPULATE` не указано, представление будет содержать только данные, добавленные в таблицу после создания представления. Использовать `POPULATE` не рекомендуется, так как в представление не попадут данные, добавляемые в таблицу во время создания представления.
-Запрос `SELECT` может содержать `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`… Следует иметь ввиду, что соответствующие преобразования будут выполняться независимо, на каждый блок вставляемых данных. Например, при наличии `GROUP BY`, данные будут агрегироваться при вставке, но только в рамках одной пачки вставляемых данных. Далее, данные не будут доагрегированы. Исключение - использование ENGINE, производящего агрегацию данных самостоятельно, например, `SummingMergeTree`.
+Запрос `SELECT` может содержать `DISTINCT`, `GROUP BY`, `ORDER BY`, `LIMIT`... Следует иметь ввиду, что соответствующие преобразования будут выполняться независимо, на каждый блок вставляемых данных. Например, при наличии `GROUP BY`, данные будут агрегироваться при вставке, но только в рамках одной пачки вставляемых данных. Далее, данные не будут доагрегированы. Исключение - использование ENGINE, производящего агрегацию данных самостоятельно, например, `SummingMergeTree`.
Выполнение запросов [ALTER](../../../sql-reference/statements/alter/view.md) над материализованными представлениями имеет свои особенности, поэтому эти запросы могут быть неудобными для использования. Если материализованное представление использует конструкцию `TO [db.]name`, то можно выполнить `DETACH` представления, `ALTER` для целевой таблицы и последующий `ATTACH` ранее отсоединенного (`DETACH`) представления.
diff --git a/docs/ru/sql-reference/statements/insert-into.md b/docs/ru/sql-reference/statements/insert-into.md
index 747e36b8809..309d4852b11 100644
--- a/docs/ru/sql-reference/statements/insert-into.md
+++ b/docs/ru/sql-reference/statements/insert-into.md
@@ -73,7 +73,7 @@ INSERT INTO insert_select_testtable VALUES (1, DEFAULT, 1) ;
INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set
```
-Например, следующий формат запроса идентичен базовому варианту INSERT … VALUES:
+Например, следующий формат запроса идентичен базовому варианту INSERT ... VALUES:
``` sql
INSERT INTO [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ...
diff --git a/docs/ru/sql-reference/table-functions/file.md b/docs/ru/sql-reference/table-functions/file.md
index 5331cf00728..546a674d41a 100644
--- a/docs/ru/sql-reference/table-functions/file.md
+++ b/docs/ru/sql-reference/table-functions/file.md
@@ -116,7 +116,7 @@ SELECT count(*) FROM file('{some,another}_dir/*', 'TSV', 'name String, value UIn
**Пример**
-Запрос данных из файлов с именами `file000`, `file001`, … , `file999`:
+Запрос данных из файлов с именами `file000`, `file001`, ... , `file999`:
``` sql
SELECT count(*) FROM file('big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32');
diff --git a/docs/ru/sql-reference/table-functions/s3.md b/docs/ru/sql-reference/table-functions/s3.md
index fe40cb0c507..2847a95bf19 100644
--- a/docs/ru/sql-reference/table-functions/s3.md
+++ b/docs/ru/sql-reference/table-functions/s3.md
@@ -108,7 +108,7 @@ FROM s3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_prefi
Если список файлов содержит диапазоны чисел с ведущими нулями, используйте конструкцию с фигурными скобками для каждой цифры отдельно или используйте `?`.
:::
-Подсчитаем общее количество строк в файлах с именами `file-000.csv`, `file-001.csv`, … , `file-999.csv`:
+Подсчитаем общее количество строк в файлах с именами `file-000.csv`, `file-001.csv`, ... , `file-999.csv`:
``` sql
SELECT count(*)
diff --git a/docs/zh/changelog/index.md b/docs/zh/changelog/index.md
index 7afcc07c6fb..c91d8bcf4d1 100644
--- a/docs/zh/changelog/index.md
+++ b/docs/zh/changelog/index.md
@@ -190,7 +190,7 @@ sidebar_label: "\u53D8\u66F4\u65E5\u5FD7"
- 如果在获取系统数据时发生了zookeeper异常。副本,将其显示在单独的列中。 这实现了 [#9137](https://github.com/ClickHouse/ClickHouse/issues/9137) [#9138](https://github.com/ClickHouse/ClickHouse/pull/9138) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))
- 原子删除destroy上的MergeTree数据部分。 [#8402](https://github.com/ClickHouse/ClickHouse/pull/8402) ([Vladimir Chebotarev](https://github.com/excitoon))
- 支持分布式表的行级安全性。 [#8926](https://github.com/ClickHouse/ClickHouse/pull/8926) ([伊万](https://github.com/abyss7))
-- Now we recognize suffix (like KB, KiB…) in settings values. [#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([米哈伊尔\*科罗托夫](https://github.com/millb))
+- Now we recognize suffix (like KB, KiB...) in settings values. [#8072](https://github.com/ClickHouse/ClickHouse/pull/8072) ([米哈伊尔\*科罗托夫](https://github.com/millb))
- 在构建大型连接的结果时防止内存不足。 [#8637](https://github.com/ClickHouse/ClickHouse/pull/8637) ([Artem Zuikov](https://github.com/4ertus2))
- 在交互模式下为建议添加群集名称 `clickhouse-client`. [#8709](https://github.com/ClickHouse/ClickHouse/pull/8709) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))
- Initialize query profiler for all threads in a group, e.g. it allows to fully profile insert-queries [#8820](https://github.com/ClickHouse/ClickHouse/pull/8820) ([伊万](https://github.com/abyss7))
@@ -523,7 +523,7 @@ sidebar_label: "\u53D8\u66F4\u65E5\u5FD7"
- 现在后台在磁盘之间移动,运行它的seprate线程池。 [#7670](https://github.com/ClickHouse/ClickHouse/pull/7670) ([Vladimir Chebotarev](https://github.com/excitoon))
- `SYSTEM RELOAD DICTIONARY` 现在同步执行。 [#8240](https://github.com/ClickHouse/ClickHouse/pull/8240) ([维塔利\*巴拉诺夫](https://github.com/vitlibar))
- 堆栈跟踪现在显示物理地址(对象文件中的偏移量),而不是虚拟内存地址(加载对象文件的位置)。 这允许使用 `addr2line` 当二进制独立于位置并且ASLR处于活动状态时。 这修复 [#8360](https://github.com/ClickHouse/ClickHouse/issues/8360). [#8387](https://github.com/ClickHouse/ClickHouse/pull/8387) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))
-- 支持行级安全筛选器的新语法: ``. 修复 [#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([伊万](https://github.com/abyss7))
+- 支持行级安全筛选器的新语法: ``. 修复 [#5779](https://github.com/ClickHouse/ClickHouse/issues/5779). [#8381](https://github.com/ClickHouse/ClickHouse/pull/8381) ([伊万](https://github.com/abyss7))
- 现在 `cityHash` 功能可以与工作 `Decimal` 和 `UUID` 类型。 修复 [#5184](https://github.com/ClickHouse/ClickHouse/issues/5184). [#7693](https://github.com/ClickHouse/ClickHouse/pull/7693) ([米哈伊尔\*科罗托夫](https://github.com/millb))
- 从系统日志中删除了固定的索引粒度(它是1024),因为它在实现自适应粒度之后已经过时。 [#7698](https://github.com/ClickHouse/ClickHouse/pull/7698) ([阿列克谢-米洛维多夫](https://github.com/alexey-milovidov))
- 当ClickHouse在没有SSL的情况下编译时,启用MySQL兼容服务器。 [#7852](https://github.com/ClickHouse/ClickHouse/pull/7852) ([尤里\*巴拉诺夫](https://github.com/yurriy))
diff --git a/docs/zh/development/style.md b/docs/zh/development/style.md
index c0a08291e02..724b22ad461 100644
--- a/docs/zh/development/style.md
+++ b/docs/zh/development/style.md
@@ -53,7 +53,7 @@ memcpy(&buf[place_value], &x, sizeof(x));
for (size_t i = 0; i < rows; i += storage.index_granularity)
```
-**7.** 在二元运算符(`+`,`-`,`*`,`/`,`%`,…)和三元运算符 `?:` 周围添加空格。
+**7.** 在二元运算符(`+`,`-`,`*`,`/`,`%`,...)和三元运算符 `?:` 周围添加空格。
``` cpp
UInt16 year = (s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
@@ -82,7 +82,7 @@ dst.ClickGoodEvent = click.GoodEvent;
如有必要,运算符可以包裹到下一行。 在这种情况下,它前面的偏移量增加。
-**11.** 不要使用空格来分开一元运算符 (`--`, `++`, `*`, `&`, …) 和参数。
+**11.** 不要使用空格来分开一元运算符 (`--`, `++`, `*`, `&`, ...) 和参数。
**12.** 在逗号后面加一个空格,而不是在之前。同样的规则也适合 `for` 循环中的分号。
@@ -111,7 +111,7 @@ public:
**16.** 如果对整个文件使用相同的 `namespace`,并且没有其他重要的东西,则 `namespace` 中不需要偏移量。
-**17.** 在 `if`, `for`, `while` 中包裹的代码块中,若代码是一个单行的 `statement`,那么大括号是可选的。 可以将 `statement` 放到一行中。这个规则同样适用于嵌套的 `if`, `for`, `while`, …
+**17.** 在 `if`, `for`, `while` 中包裹的代码块中,若代码是一个单行的 `statement`,那么大括号是可选的。 可以将 `statement` 放到一行中。这个规则同样适用于嵌套的 `if`, `for`, `while`, ...
但是如果内部 `statement` 包含大括号或 `else`,则外部块应该用大括号括起来。
@@ -262,7 +262,7 @@ void executeQuery(
这个示例来源于 http://home.tamk.fi/~jaalto/course/coding-style/doc/unmaintainable-code/。
-**7.** 不要在每个文件的开头写入垃圾注释(作者,创建日期…)。
+**7.** 不要在每个文件的开头写入垃圾注释(作者,创建日期...)。
**8.** 单行注释用三个斜杆: `///` ,多行注释以 `/**`开始。 这些注释会当做文档。
diff --git a/docs/zh/engines/table-engines/integrations/hdfs.md b/docs/zh/engines/table-engines/integrations/hdfs.md
index 55648afe407..be673b6ce92 100644
--- a/docs/zh/engines/table-engines/integrations/hdfs.md
+++ b/docs/zh/engines/table-engines/integrations/hdfs.md
@@ -103,7 +103,7 @@ CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = HDFS('hdfs
**示例**
-创建具有名为文件的表 `file000`, `file001`, … , `file999`:
+创建具有名为文件的表 `file000`, `file001`, ... , `file999`:
``` sql
CREARE TABLE big_table (name String, value UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV')
diff --git a/docs/zh/engines/table-engines/integrations/s3.md b/docs/zh/engines/table-engines/integrations/s3.md
index f2585decabf..f18814675c3 100644
--- a/docs/zh/engines/table-engines/integrations/s3.md
+++ b/docs/zh/engines/table-engines/integrations/s3.md
@@ -109,7 +109,7 @@ CREATE TABLE table_with_asterisk (name String, value UInt32) ENGINE = S3('https:
**示例**
-使用文件`file-000.csv`, `file-001.csv`, … , `file-999.csv`来创建表:
+使用文件`file-000.csv`, `file-001.csv`, ... , `file-999.csv`来创建表:
``` sql
CREATE TABLE big_table (name String, value UInt32) ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/big_prefix/file-{000..999}.csv', 'CSV');
@@ -202,7 +202,7 @@ ENGINE = S3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_p
!!! warning "Warning"
如果文件列表中包含有从0开头的数字范围,请对每个数字分别使用带括号的结构,或者使用`?`.
-4. 从文件`file-000.csv`, `file-001.csv`, … , `file-999.csv`创建表:
+4. 从文件`file-000.csv`, `file-001.csv`, ... , `file-999.csv`创建表:
``` sql
CREATE TABLE big_table (name String, value UInt32)
diff --git a/docs/zh/engines/table-engines/mergetree-family/custom-partitioning-key.md b/docs/zh/engines/table-engines/mergetree-family/custom-partitioning-key.md
index 4fecf4e5669..e283a4c7510 100644
--- a/docs/zh/engines/table-engines/mergetree-family/custom-partitioning-key.md
+++ b/docs/zh/engines/table-engines/mergetree-family/custom-partitioning-key.md
@@ -59,7 +59,7 @@ WHERE table = 'visits'
└───────────┴────────────────┴────────┘
```
-`partition` 列存储分区的名称。此示例中有两个分区:`201901` 和 `201902`。在 [ALTER … PARTITION](#alter_manipulations-with-partitions) 语句中你可以使用该列值来指定分区名称。
+`partition` 列存储分区的名称。此示例中有两个分区:`201901` 和 `201902`。在 [ALTER ... PARTITION](#alter_manipulations-with-partitions) 语句中你可以使用该列值来指定分区名称。
`name` 列为分区中数据片段的名称。在 [ALTER ATTACH PART](#alter_attach-partition) 语句中你可以使用此列值中来指定片段名称。
diff --git a/docs/zh/engines/table-engines/mergetree-family/mergetree.md b/docs/zh/engines/table-engines/mergetree-family/mergetree.md
index bfa69338657..67bd681269b 100644
--- a/docs/zh/engines/table-engines/mergetree-family/mergetree.md
+++ b/docs/zh/engines/table-engines/mergetree-family/mergetree.md
@@ -702,7 +702,7 @@ SETTINGS storage_policy = 'moving_from_ssd_to_hdd'
- 插入(`INSERT`查询)
- 后台合并和[数据变异](../../../sql-reference/statements/alter.md#alter-mutations)
- 从另一个副本下载
-- [ALTER TABLE … FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition) 冻结分区
+- [ALTER TABLE ... FREEZE PARTITION](../../../sql-reference/statements/alter.md#alter_freeze-partition) 冻结分区
除了数据变异和冻结分区以外的情况下,数据按照以下逻辑存储到卷或磁盘上:
@@ -713,7 +713,7 @@ SETTINGS storage_policy = 'moving_from_ssd_to_hdd'
在后台,数据片段基于剩余空间(`move_factor`参数)根据卷在配置文件中定义的顺序进行转移。数据永远不会从最后一个移出也不会从第一个移入。可以通过系统表 [system.part_log](../../../operations/system-tables/part_log.md#system_tables-part-log) (字段 `type = MOVE_PART`) 和 [system.parts](../../../operations/system-tables/parts.md#system_tables-parts) (字段 `path` 和 `disk`) 来监控后台的移动情况。具体细节可以通过服务器日志查看。
-用户可以通过 [ALTER TABLE … MOVE PART\|PARTITION … TO VOLUME\|DISK …](../../../sql-reference/statements/alter.md#alter_move-partition) 强制移动一个数据片段或分区到另外一个卷,所有后台移动的限制都会被考虑在内。这个查询会自行启动,无需等待后台操作完成。如果没有足够的可用空间或任何必须条件没有被满足,用户会收到报错信息。
+用户可以通过 [ALTER TABLE ... MOVE PART\|PARTITION ... TO VOLUME\|DISK ...](../../../sql-reference/statements/alter.md#alter_move-partition) 强制移动一个数据片段或分区到另外一个卷,所有后台移动的限制都会被考虑在内。这个查询会自行启动,无需等待后台操作完成。如果没有足够的可用空间或任何必须条件没有被满足,用户会收到报错信息。
数据移动不会妨碍到数据复制。也就是说,同一张表的不同副本可以指定不同的存储策略。
diff --git a/docs/zh/engines/table-engines/special/external-data.md b/docs/zh/engines/table-engines/special/external-data.md
index 688e25402ab..06c6331b4f3 100644
--- a/docs/zh/engines/table-engines/special/external-data.md
+++ b/docs/zh/engines/table-engines/special/external-data.md
@@ -26,7 +26,7 @@ ClickHouse 允许向服务器发送处理查询所需的数据以及 SELECT 查
以下的参数是可选的:**–name** – 表的名称,如果省略,则采用 _data。
**–format** – 文件中的数据格式。 如果省略,则使用 TabSeparated。
-以下的参数必选一个:**–types** – 逗号分隔列类型的列表。例如:`UInt64,String`。列将被命名为 _1,_2,…
+以下的参数必选一个:**–types** – 逗号分隔列类型的列表。例如:`UInt64,String`。列将被命名为 _1,_2,...
**–structure**– 表结构的格式 `UserID UInt64`,`URL String`。定义列的名字以及类型。
在 «file» 中指定的文件将由 «format» 中指定的格式解析,使用在 «types» 或 «structure» 中指定的数据类型。该表将被上传到服务器,并在作为名称为 «name»临时表。
diff --git a/docs/zh/faq/general/olap.md b/docs/zh/faq/general/olap.md
index b014419578b..c4b36b138fa 100644
--- a/docs/zh/faq/general/olap.md
+++ b/docs/zh/faq/general/olap.md
@@ -10,13 +10,13 @@ sidebar_position: 100
[OLAP](https://en.wikipedia.org/wiki/Online_analytical_processing) stands for Online Analytical Processing. It is a broad term that can be looked at from two perspectives: technical and business. But at the very high level, you can just read these words backward:
Processing
-: Some source data is processed…
+: Some source data is processed...
Analytical
-: …to produce some analytical reports and insights…
+: ...to produce some analytical reports and insights...
Online
-: …in real-time.
+: ...in real-time.
## OLAP from the Business Perspective {#olap-from-the-business-perspective}
diff --git a/docs/zh/getting-started/example-datasets/nyc-taxi.md b/docs/zh/getting-started/example-datasets/nyc-taxi.md
index 9c487140df3..ceeb6fbb9e0 100644
--- a/docs/zh/getting-started/example-datasets/nyc-taxi.md
+++ b/docs/zh/getting-started/example-datasets/nyc-taxi.md
@@ -196,7 +196,7 @@ real 75m56.214s
(也可以直接使用`COPY ... TO PROGRAM`从Postgres中导入数据)
-数据中所有与天气相关的字段(precipitation……average_wind_speed)都填充了NULL。 所以,我们将从最终数据集中删除它们
+数据中所有与天气相关的字段(precipitation...average_wind_speed)都填充了NULL。 所以,我们将从最终数据集中删除它们
首先,我们使用单台服务器创建表,后面我们将在多台节点上创建这些表。
diff --git a/docs/zh/getting-started/example-datasets/uk-price-paid.mdx b/docs/zh/getting-started/example-datasets/uk-price-paid.mdx
index ecfdcddbbe2..7d4c299b919 100644
--- a/docs/zh/getting-started/example-datasets/uk-price-paid.mdx
+++ b/docs/zh/getting-started/example-datasets/uk-price-paid.mdx
@@ -212,7 +212,7 @@ ORDER BY year
└──────┴─────────┴───────────────────────────────────────────────────────┘
```
-2020 年房价出事了!但这并不令人意外……
+2020 年房价出事了!但这并不令人意外...
### 查询 3. 最昂贵的社区 {#most-expensive-neighborhoods}
diff --git a/docs/zh/guides/improving-query-performance/sparse-primary-indexes.md b/docs/zh/guides/improving-query-performance/sparse-primary-indexes.md
index 758992e4084..975d5eb764c 100644
--- a/docs/zh/guides/improving-query-performance/sparse-primary-indexes.md
+++ b/docs/zh/guides/improving-query-performance/sparse-primary-indexes.md
@@ -371,7 +371,7 @@ UserID.bin,URL.bin,和EventTime.bin是UserID
:::note
- 最后一个索引条目(上图中的“mark 1082”)存储了上图中颗粒1082的主键列的最大值。
-- 索引条目(索引标记)不是基于表中的特定行,而是基于颗粒。例如,对于上图中的索引条目‘mark 0’,在我们的表中没有UserID为240.923且URL为“goal://metry=10000467796a411…”的行,相反,对于该表,有一个颗粒0,在该颗粒中,最小UserID值是240.923,最小URL值是“goal://metry=10000467796a411…”,这两个值来自不同的行。
+- 索引条目(索引标记)不是基于表中的特定行,而是基于颗粒。例如,对于上图中的索引条目‘mark 0’,在我们的表中没有UserID为240.923且URL为“goal://metry=10000467796a411...”的行,相反,对于该表,有一个颗粒0,在该颗粒中,最小UserID值是240.923,最小URL值是“goal://metry=10000467796a411...”,这两个值来自不同的行。
- 主索引文件完全加载到主内存中。如果文件大于可用的空闲内存空间,则ClickHouse将发生错误。
:::
diff --git a/docs/zh/index.md b/docs/zh/index.md
index fab00dbcd1b..c092f296722 100644
--- a/docs/zh/index.md
+++ b/docs/zh/index.md
@@ -13,10 +13,10 @@ ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS)
| Row | WatchID | JavaEnable | Title | GoodEvent | EventTime |
|-----|-------------|------------|--------------------|-----------|---------------------|
-| #0 | 89354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 |
-| #1 | 90329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 |
-| #2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 |
-| #N | … | … | … | … | … |
+| #0 | 89354350662 | 1 | Investor Relations | 1 | 2016-05-18 05:19:20 |
+| #1 | 90329509958 | 0 | Contact us | 1 | 2016-05-18 08:10:20 |
+| #2 | 89953706054 | 1 | Mission | 1 | 2016-05-18 07:38:00 |
+| #N | ... | ... | ... | ... | ... |
处于同一行中的数据总是被物理的存储在一起。
@@ -24,13 +24,13 @@ ClickHouse是一个用于联机分析(OLAP)的列式数据库管理系统(DBMS)
在列式数据库系统中,数据按如下的顺序存储:
-| Row: | #0 | #1 | #2 | #N |
+| Row: | #0 | #1 | #2 | #N |
|-------------|---------------------|---------------------|---------------------|-----|
-| WatchID: | 89354350662 | 90329509958 | 89953706054 | … |
-| JavaEnable: | 1 | 0 | 1 | … |
-| Title: | Investor Relations | Contact us | Mission | … |
-| GoodEvent: | 1 | 1 | 1 | … |
-| EventTime: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | … |
+| WatchID: | 89354350662 | 90329509958 | 89953706054 | ... |
+| JavaEnable: | 1 | 0 | 1 | ... |
+| Title: | Investor Relations | Contact us | Mission | ... |
+| GoodEvent: | 1 | 1 | 1 | ... |
+| EventTime: | 2016-05-18 05:19:20 | 2016-05-18 08:10:20 | 2016-05-18 07:38:00 | ... |
这些示例只显示了数据的排列顺序。来自不同列的值被单独存储,来自同一列的数据被存储在一起。
diff --git a/docs/zh/operations/settings/query-complexity.md b/docs/zh/operations/settings/query-complexity.md
index 124d5fa5d1a..b1b5ca75018 100644
--- a/docs/zh/operations/settings/query-complexity.md
+++ b/docs/zh/operations/settings/query-complexity.md
@@ -196,7 +196,7 @@ Restrictions on the «maximum amount of something» can take the value 0, which
Limits the number of rows in the hash table that is used when joining tables.
-This settings applies to [SELECT … JOIN](../../sql-reference/statements/select/join.md#select-join) operations and the [Join](../../engines/table-engines/special/join.md) table engine.
+This settings applies to [SELECT ... JOIN](../../sql-reference/statements/select/join.md#select-join) operations and the [Join](../../engines/table-engines/special/join.md) table engine.
If a query contains multiple joins, ClickHouse checks this setting for every intermediate result.
@@ -213,7 +213,7 @@ Default value: 0.
Limits the size in bytes of the hash table used when joining tables.
-This settings applies to [SELECT … JOIN](../../sql-reference/statements/select/join.md#select-join) operations and [Join table engine](../../engines/table-engines/special/join.md).
+This settings applies to [SELECT ... JOIN](../../sql-reference/statements/select/join.md#select-join) operations and [Join table engine](../../engines/table-engines/special/join.md).
If the query contains joins, ClickHouse checks this setting for every intermediate result.
diff --git a/docs/zh/operations/settings/settings.md b/docs/zh/operations/settings/settings.md
index c3b4194ed44..5e59196f56c 100644
--- a/docs/zh/operations/settings/settings.md
+++ b/docs/zh/operations/settings/settings.md
@@ -1002,7 +1002,7 @@ ClickHouse生成异常
## count_distinct_implementation {#settings-count_distinct_implementation}
-指定其中的 `uniq*` 函数应用于执行 [COUNT(DISTINCT …)](../../sql-reference/aggregate-functions/reference/count.md#agg_function-count) 建筑。
+指定其中的 `uniq*` 函数应用于执行 [COUNT(DISTINCT ...)](../../sql-reference/aggregate-functions/reference/count.md#agg_function-count) 建筑。
可能的值:
diff --git a/docs/zh/operations/system-tables/dictionaries.md b/docs/zh/operations/system-tables/dictionaries.md
index 0cf91e45e86..c7b1bdd04be 100644
--- a/docs/zh/operations/system-tables/dictionaries.md
+++ b/docs/zh/operations/system-tables/dictionaries.md
@@ -21,7 +21,7 @@ machine_translated_rev: 5decc73b5dc60054f19087d3690c4eb99446a6c3
- `FAILED_AND_RELOADING` — Could not load the dictionary as a result of an error and is loading now.
- `origin` ([字符串](../../sql-reference/data-types/string.md)) — Path to the configuration file that describes the dictionary.
- `type` ([字符串](../../sql-reference/data-types/string.md)) — Type of dictionary allocation. [在内存中存储字典](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-layout.md).
-- `key` — [密钥类型](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-key):数字键 ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) or Сomposite key ([字符串](../../sql-reference/data-types/string.md)) — form “(type 1, type 2, …, type n)”.
+- `key` — [密钥类型](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-key):数字键 ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) or Сomposite key ([字符串](../../sql-reference/data-types/string.md)) — form “(type 1, type 2, ..., type n)”.
- `attribute.names` ([阵列](../../sql-reference/data-types/array.md)([字符串](../../sql-reference/data-types/string.md))) — Array of [属性名称](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) 由字典提供。
- `attribute.types` ([阵列](../../sql-reference/data-types/array.md)([字符串](../../sql-reference/data-types/string.md))) — Corresponding array of [属性类型](../../sql-reference/dictionaries/external-dictionaries/external-dicts-dict-structure.md#ext_dict_structure-attributes) 这是由字典提供。
- `bytes_allocated` ([UInt64](../../sql-reference/data-types/int-uint.md#uint-ranges)) — Amount of RAM allocated for the dictionary.
diff --git a/docs/zh/sql-reference/aggregate-functions/parametric-functions.md b/docs/zh/sql-reference/aggregate-functions/parametric-functions.md
index cb1dcc35f5c..27d3375aebb 100644
--- a/docs/zh/sql-reference/aggregate-functions/parametric-functions.md
+++ b/docs/zh/sql-reference/aggregate-functions/parametric-functions.md
@@ -80,7 +80,7 @@ FROM
在这种情况下,您应该记住您不知道直方图bin边界。
-## sequenceMatch(pattern)(timestamp, cond1, cond2, …) {#function-sequencematch}
+## sequenceMatch(pattern)(timestamp, cond1, cond2, ...) {#function-sequencematch}
检查序列是否包含与模式匹配的事件链。
@@ -167,7 +167,7 @@ SELECT sequenceMatch('(?1)(?2)')(time, number = 1, number = 2, number = 4) FROM
- [sequenceCount](#function-sequencecount)
-## sequenceCount(pattern)(time, cond1, cond2, …) {#function-sequencecount}
+## sequenceCount(pattern)(time, cond1, cond2, ...) {#function-sequencecount}
计算与模式匹配的事件链的数量。该函数搜索不重叠的事件链。当前链匹配后,它开始搜索下一个链。
diff --git a/docs/zh/sql-reference/aggregate-functions/reference/quantiles.md b/docs/zh/sql-reference/aggregate-functions/reference/quantiles.md
index 4dce65af1ed..253eb9ef82d 100644
--- a/docs/zh/sql-reference/aggregate-functions/reference/quantiles.md
+++ b/docs/zh/sql-reference/aggregate-functions/reference/quantiles.md
@@ -7,7 +7,7 @@ sidebar_position: 201
**语法**
``` sql
-quantiles(level1, level2, …)(x)
+quantiles(level1, level2, ...)(x)
```
所有分位数函数(quantile)也有相应的分位数(quantiles)函数: `quantiles`, `quantilesDeterministic`, `quantilesTiming`, `quantilesTimingWeighted`, `quantilesExact`, `quantilesExactWeighted`, `quantilesTDigest`。 这些函数一次计算所列的级别的所有分位数, 并返回结果值的数组。
diff --git a/docs/zh/sql-reference/data-types/aggregatefunction.md b/docs/zh/sql-reference/data-types/aggregatefunction.md
index e8f28b367a5..80648eb165b 100644
--- a/docs/zh/sql-reference/data-types/aggregatefunction.md
+++ b/docs/zh/sql-reference/data-types/aggregatefunction.md
@@ -1,7 +1,7 @@
---
slug: /zh/sql-reference/data-types/aggregatefunction
---
-# AggregateFunction(name, types_of_arguments…) {#data-type-aggregatefunction}
+# AggregateFunction(name, types_of_arguments...) {#data-type-aggregatefunction}
聚合函数的中间状态,可以通过聚合函数名称加`-State`后缀的形式得到它。与此同时,当您需要访问该类型的最终状态数据时,您需要以相同的聚合函数名加`-Merge`后缀的形式来得到最终状态数据。
diff --git a/docs/zh/sql-reference/data-types/domains/index.md b/docs/zh/sql-reference/data-types/domains/index.md
index c123b10f6fe..9f12018732b 100644
--- a/docs/zh/sql-reference/data-types/domains/index.md
+++ b/docs/zh/sql-reference/data-types/domains/index.md
@@ -19,9 +19,9 @@ Domain类型是特定实现的类型,它总是与某个现存的基础类型
### Domains的额外特性 {#domainsde-e-wai-te-xing}
- 在执行SHOW CREATE TABLE 或 DESCRIBE TABLE时,其对应的列总是展示为Domain类型的名称
-- 在INSERT INTO domain_table(domain_column) VALUES(…)中输入数据总是以更人性化的格式进行输入
+- 在INSERT INTO domain_table(domain_column) VALUES(...)中输入数据总是以更人性化的格式进行输入
- 在SELECT domain_column FROM domain_table中数据总是以更人性化的格式输出
-- 在INSERT INTO domain_table FORMAT CSV …中,实现外部源数据以更人性化的格式载入
+- 在INSERT INTO domain_table FORMAT CSV ...中,实现外部源数据以更人性化的格式载入
### Domains类型的限制 {#domainslei-xing-de-xian-zhi}
diff --git a/docs/zh/sql-reference/data-types/fixedstring.md b/docs/zh/sql-reference/data-types/fixedstring.md
index 633307938a9..d454e935fe7 100644
--- a/docs/zh/sql-reference/data-types/fixedstring.md
+++ b/docs/zh/sql-reference/data-types/fixedstring.md
@@ -18,8 +18,8 @@ slug: /zh/sql-reference/data-types/fixedstring
可以有效存储在`FixedString`类型的列中的值的示例:
- 二进制表示的IP地址(IPv6使用`FixedString(16)`)
-- 语言代码(ru_RU, en_US … )
-- 货币代码(USD, RUB … )
+- 语言代码(ru_RU, en_US ... )
+- 货币代码(USD, RUB ... )
- 二进制表示的哈希值(MD5使用`FixedString(16)`,SHA256使用`FixedString(32)`)
请使用[UUID](uuid.md)数据类型来存储UUID值,。
diff --git a/docs/zh/sql-reference/data-types/nested-data-structures/nested.md b/docs/zh/sql-reference/data-types/nested-data-structures/nested.md
index 5ef8256b483..57b30de0881 100644
--- a/docs/zh/sql-reference/data-types/nested-data-structures/nested.md
+++ b/docs/zh/sql-reference/data-types/nested-data-structures/nested.md
@@ -1,7 +1,7 @@
---
slug: /zh/sql-reference/data-types/nested-data-structures/nested
---
-# Nested(Name1 Type1, Name2 Type2, …) {#nestedname1-type1-name2-type2}
+# Nested(Name1 Type1, Name2 Type2, ...) {#nestedname1-type1-name2-type2}
嵌套数据结构类似于嵌套表。嵌套数据结构的参数(列名和类型)与 CREATE 查询类似。每个表可以包含任意多行嵌套数据结构。
diff --git a/docs/zh/sql-reference/data-types/simpleaggregatefunction.md b/docs/zh/sql-reference/data-types/simpleaggregatefunction.md
index 601cb602a78..fbaa76365ec 100644
--- a/docs/zh/sql-reference/data-types/simpleaggregatefunction.md
+++ b/docs/zh/sql-reference/data-types/simpleaggregatefunction.md
@@ -3,7 +3,7 @@ slug: /zh/sql-reference/data-types/simpleaggregatefunction
---
# SimpleAggregateFunction {#data-type-simpleaggregatefunction}
-`SimpleAggregateFunction(name, types_of_arguments…)` 数据类型存储聚合函数的当前值, 并不像 [`AggregateFunction`](../../sql-reference/data-types/aggregatefunction.md) 那样存储其全部状态。这种优化可以应用于具有以下属性函数: 将函数 `f` 应用于行集合 `S1 UNION ALL S2` 的结果,可以通过将 `f` 分别应用于行集合的部分, 然后再将 `f` 应用于结果来获得: `f(S1 UNION ALL S2) = f(f(S1) UNION ALL f(S2))`。 这个属性保证了部分聚合结果足以计算出合并的结果,所以我们不必存储和处理任何额外的数据。
+`SimpleAggregateFunction(name, types_of_arguments...)` 数据类型存储聚合函数的当前值, 并不像 [`AggregateFunction`](../../sql-reference/data-types/aggregatefunction.md) 那样存储其全部状态。这种优化可以应用于具有以下属性函数: 将函数 `f` 应用于行集合 `S1 UNION ALL S2` 的结果,可以通过将 `f` 分别应用于行集合的部分, 然后再将 `f` 应用于结果来获得: `f(S1 UNION ALL S2) = f(f(S1) UNION ALL f(S2))`。 这个属性保证了部分聚合结果足以计算出合并的结果,所以我们不必存储和处理任何额外的数据。
支持以下聚合函数:
diff --git a/docs/zh/sql-reference/data-types/tuple.md b/docs/zh/sql-reference/data-types/tuple.md
index 004c80ff916..38813701c70 100644
--- a/docs/zh/sql-reference/data-types/tuple.md
+++ b/docs/zh/sql-reference/data-types/tuple.md
@@ -1,7 +1,7 @@
---
slug: /zh/sql-reference/data-types/tuple
---
-# Tuple(T1, T2, …) {#tuplet1-t2}
+# Tuple(T1, T2, ...) {#tuplet1-t2}
元组,其中每个元素都有单独的 [类型](index.md#data_types)。
diff --git a/docs/zh/sql-reference/functions/array-functions.md b/docs/zh/sql-reference/functions/array-functions.md
index d150b94b8af..69db34e4a36 100644
--- a/docs/zh/sql-reference/functions/array-functions.md
+++ b/docs/zh/sql-reference/functions/array-functions.md
@@ -152,7 +152,7 @@ SELECT range(5), range(1, 5), range(1, 5, 2), range(-1, 5, 2);
└─────────────┴─────────────┴────────────────┴─────────────────┘
```
-## array(x1, …), operator \[x1, …\] {#arrayx1-operator-x1}
+## array(x1, ...), operator \[x1, ...\] {#arrayx1-operator-x1}
使用函数的参数作为数组元素创建一个数组。
参数必须是常量,并且具有最小公共类型的类型。必须至少传递一个参数,否则将不清楚要创建哪种类型的数组。也就是说,你不能使用这个函数来创建一个空数组(为此,使用上面描述的’emptyArray \*’函数)。
@@ -337,7 +337,7 @@ SELECT indexOf([1, 3, NULL, NULL], NULL)
设置为«NULL»的元素将作为普通的元素值处理。
-## arrayCount(\[func,\] arr1, …) {#array-count}
+## arrayCount(\[func,\] arr1, ...) {#array-count}
`func`将arr数组作为参数,其返回结果为非零值的数量。如果未指定“func”,则返回数组中非零元素的数量。
@@ -363,7 +363,7 @@ SELECT countEqual([1, 2, NULL, NULL], NULL)
## arrayEnumerate(arr) {#array_functions-arrayenumerate}
-返回 Array \[1, 2, 3, …, length (arr) \]
+返回 Array \[1, 2, 3, ..., length (arr) \]
此功能通常与ARRAY JOIN一起使用。它允许在应用ARRAY JOIN后为每个数组计算一次。例如:
@@ -403,7 +403,7 @@ WHERE (CounterID = 160656) AND notEmpty(GoalsReached)
此功能也可用于高阶函数。例如,您可以使用它来获取与条件匹配的元素的数组索引。
-## arrayEnumerateUniq(arr, …) {#arrayenumerateuniqarr}
+## arrayEnumerateUniq(arr, ...) {#arrayenumerateuniqarr}
返回与源数组大小相同的数组,其中每个元素表示与其下标对应的源数组元素在源数组中出现的次数。
例如:arrayEnumerateUniq( \[10,20,10,30 \])= \[1,1,2,1 \]。
@@ -621,7 +621,7 @@ SELECT arraySlice([1, 2, NULL, 4, 5], 2, 3) AS res
设置为«NULL»的数组元素作为普通的数组元素值处理。
-## arraySort(\[func,\] arr, …) {#array_functions-reverse-sort}
+## arraySort(\[func,\] arr, ...) {#array_functions-reverse-sort}
以升序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arraySort`函数也将解析与`func`函数参数相同数量的数组参数。更详细的示例在`arraySort`的末尾。
@@ -721,7 +721,7 @@ SELECT arraySort((x, y) -> -y, [0, 1, 2], [1, 2, 3]) as res;
!!! 注意 "注意"
为了提高排序效率, 使用了[施瓦茨变换](https://en.wikipedia.org/wiki/Schwartzian_transform)。
-## arrayReverseSort(\[func,\] arr, …) {#array_functions-reverse-sort}
+## arrayReverseSort(\[func,\] arr, ...) {#array_functions-reverse-sort}
以降序对`arr`数组的元素进行排序。如果指定了`func`函数,则排序顺序由`func`函数的调用结果决定。如果`func`接受多个参数,那么`arrayReverseSort`函数也将解析与`func`函数参数相同数量的数组作为参数。更详细的示例在`arrayReverseSort`的末尾。
@@ -822,7 +822,7 @@ SELECT arrayReverseSort((x, y) -> -y, [4, 3, 5], [1, 2, 3]) AS res;
└─────────┘
```
-## arrayUniq(arr, …) {#arrayuniqarr}
+## arrayUniq(arr, ...) {#arrayuniqarr}
如果传递一个参数,则计算数组中不同元素的数量。
如果传递了多个参数,则它计算多个数组中相应位置的不同元素元组的数量。
@@ -1221,7 +1221,7 @@ select arrayAUC([0.1, 0.4, 0.35, 0.8], [0, 0, 1, 1]);
└───────────────────────────────────────────────┘
```
-## arrayMap(func, arr1, …) {#array-map}
+## arrayMap(func, arr1, ...) {#array-map}
将从 `func` 函数的原始应用中获得的数组返回给 `arr` 数组中的每个元素。
@@ -1251,7 +1251,7 @@ SELECT arrayMap((x, y) -> (x, y), [1, 2, 3], [4, 5, 6]) AS res
请注意,`arrayMap` 是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayFilter(func, arr1, …) {#array-filter}
+## arrayFilter(func, arr1, ...) {#array-filter}
返回一个仅包含 `arr1` 中的元素的数组,其中 `func` 返回的值不是 0。
@@ -1284,7 +1284,7 @@ SELECT
请注意,`arrayFilter`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayFill(func, arr1, …) {#array-fill}
+## arrayFill(func, arr1, ...) {#array-fill}
从第一个元素到最后一个元素扫描`arr1`,如果`func`返回0,则用`arr1[i - 1]`替换`arr1[i]`。`arr1`的第一个元素不会被替换。
@@ -1302,7 +1302,7 @@ SELECT arrayFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5, 6, 14,
请注意,`arrayFill` 是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayReverseFill(func, arr1, …) {#array-reverse-fill}
+## arrayReverseFill(func, arr1, ...) {#array-reverse-fill}
从最后一个元素到第一个元素扫描`arr1`,如果`func`返回0,则用`arr1[i + 1]`替换`arr1[i]`。`arr1`的最后一个元素不会被替换。
@@ -1320,7 +1320,7 @@ SELECT arrayReverseFill(x -> not isNull(x), [1, null, 3, 11, 12, null, null, 5,
请注意,`arrayReverseFill`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arraySplit(func, arr1, …) {#array-split}
+## arraySplit(func, arr1, ...) {#array-split}
将 `arr1` 拆分为多个数组。当 `func` 返回 0 以外的值时,数组将在元素的左侧拆分。数组不会在第一个元素之前被拆分。
@@ -1338,7 +1338,7 @@ SELECT arraySplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
请注意,`arraySplit`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayReverseSplit(func, arr1, …) {#array-reverse-split}
+## arrayReverseSplit(func, arr1, ...) {#array-reverse-split}
将 `arr1` 拆分为多个数组。当 `func` 返回 0 以外的值时,数组将在元素的右侧拆分。数组不会在最后一个元素之后被拆分。
@@ -1356,37 +1356,37 @@ SELECT arrayReverseSplit((x, y) -> y, [1, 2, 3, 4, 5], [1, 0, 0, 1, 0]) AS res
请注意,`arrayReverseSplit`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。 您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1}
+## arrayExists(\[func,\] arr1, ...) {#arrayexistsfunc-arr1}
如果 `arr` 中至少有一个元素 `func` 返回 0 以外的值,则返回 1。否则,它返回 0。
请注意,`arrayExists`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。您可以将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1}
+## arrayAll(\[func,\] arr1, ...) {#arrayallfunc-arr1}
如果 `func` 为 `arr` 中的所有元素返回 0 以外的值,则返回 1。否则,它返回 0。
请注意,`arrayAll`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。您可以将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayFirst(func, arr1, …) {#array-first}
+## arrayFirst(func, arr1, ...) {#array-first}
返回 `arr1` 数组中 `func` 返回非 0 的值的第一个元素。
请注意,`arrayFirst`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayLast(func, arr1, …) {#array-last}
+## arrayLast(func, arr1, ...) {#array-last}
返回 `arr1` 数组中的最后一个元素,其中 `func` 返回的值不是 0。
请注意,`arrayLast`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayFirstIndex(func, arr1, …) {#array-first-index}
+## arrayFirstIndex(func, arr1, ...) {#array-first-index}
返回 `arr1` 数组中第一个元素的索引,其中 `func` 返回的值不是 0。
请注意,`arrayFirstIndex`是一个[高阶函数](../../sql-reference/functions/index.md#higher-order-functions)。您必须将 lambda 函数作为第一个参数传递给它,并且不能省略。
-## arrayLastIndex(func, arr1, …) {#array-last-index}
+## arrayLastIndex(func, arr1, ...) {#array-last-index}
返回 `arr1` 数组中最后一个元素的索引,其中 `func` 返回的值不是 0。
@@ -1612,7 +1612,7 @@ SELECT arrayAvg(x -> (x * x), [2, 4]) AS res;
└─────┘
```
-## arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1}
+## arrayCumSum(\[func,\] arr1, ...) {#arraycumsumfunc-arr1}
返回源数组中元素的部分和的数组(运行总和)。如果指定了 func 函数,则数组元素的值在求和之前由该函数转换。
diff --git a/docs/zh/sql-reference/functions/date-time-functions.md b/docs/zh/sql-reference/functions/date-time-functions.md
index d6493ffe605..18b9f3495c0 100644
--- a/docs/zh/sql-reference/functions/date-time-functions.md
+++ b/docs/zh/sql-reference/functions/date-time-functions.md
@@ -443,7 +443,7 @@ SELECT toStartOfSecond(dt64, 'Asia/Istanbul');
`toISOWeek()`是一个兼容函数,等效于`toWeek(date,3)`。
下表描述了mode参数的工作方式。
-| Mode | First day of week | Range | Week 1 is the first week … |
+| Mode | First day of week | Range | Week 1 is the first week ... |
|------|-------------------|-------|-------------------------------|
| 0 | Sunday | 0-53 | with a Sunday in this year |
| 1 | Monday | 0-53 | with 4 or more days this year |
diff --git a/docs/zh/sql-reference/functions/higher-order-functions.md b/docs/zh/sql-reference/functions/higher-order-functions.md
index 929dc6f3ea7..0e08f88bba1 100644
--- a/docs/zh/sql-reference/functions/higher-order-functions.md
+++ b/docs/zh/sql-reference/functions/higher-order-functions.md
@@ -15,13 +15,13 @@ slug: /zh/sql-reference/functions/higher-order-functions
除了’arrayMap’和’arrayFilter’以外的所有其他函数,都可以省略第一个参数(lambda函数)。在这种情况下,默认返回数组元素本身。
-### arrayMap(func, arr1, …) {#higher_order_functions-array-map}
+### arrayMap(func, arr1, ...) {#higher_order_functions-array-map}
将arr
将从’func’函数的原始应用程序获得的数组返回到’arr’数组中的每个元素。
返回从原始应用程序获得的数组 ‘func’ 函数中的每个元素 ‘arr’ 阵列。
-### arrayFilter(func, arr1, …) {#arrayfilterfunc-arr1}
+### arrayFilter(func, arr1, ...) {#arrayfilterfunc-arr1}
返回一个仅包含以下元素的数组 ‘arr1’ 对于哪个 ‘func’ 返回0以外的内容。
@@ -48,31 +48,31 @@ SELECT
│ [2] │
└─────┘
-### arrayCount(\[func,\] arr1, …) {#arraycountfunc-arr1}
+### arrayCount(\[func,\] arr1, ...) {#arraycountfunc-arr1}
返回数组arr中非零元素的数量,如果指定了’func’,则通过’func’的返回值确定元素是否为非零元素。
-### arrayExists(\[func,\] arr1, …) {#arrayexistsfunc-arr1}
+### arrayExists(\[func,\] arr1, ...) {#arrayexistsfunc-arr1}
返回数组’arr’中是否存在非零元素,如果指定了’func’,则使用’func’的返回值确定元素是否为非零元素。
-### arrayAll(\[func,\] arr1, …) {#arrayallfunc-arr1}
+### arrayAll(\[func,\] arr1, ...) {#arrayallfunc-arr1}
返回数组’arr’中是否存在为零的元素,如果指定了’func’,则使用’func’的返回值确定元素是否为零元素。
-### arraySum(\[func,\] arr1, …) {#arraysumfunc-arr1}
+### arraySum(\[func,\] arr1, ...) {#arraysumfunc-arr1}
计算arr数组的总和,如果指定了’func’,则通过’func’的返回值计算数组的总和。
-### arrayFirst(func, arr1, …) {#arrayfirstfunc-arr1}
+### arrayFirst(func, arr1, ...) {#arrayfirstfunc-arr1}
返回数组中第一个匹配的元素,函数使用’func’匹配所有元素,直到找到第一个匹配的元素。
-### arrayFirstIndex(func, arr1, …) {#arrayfirstindexfunc-arr1}
+### arrayFirstIndex(func, arr1, ...) {#arrayfirstindexfunc-arr1}
返回数组中第一个匹配的元素的下标索引,函数使用’func’匹配所有元素,直到找到第一个匹配的元素。
-### arrayCumSum(\[func,\] arr1, …) {#arraycumsumfunc-arr1}
+### arrayCumSum(\[func,\] arr1, ...) {#arraycumsumfunc-arr1}
返回源数组部分数据的总和,如果指定了`func`函数,则使用`func`的返回值计算总和。
@@ -98,7 +98,7 @@ SELECT arrayCumSumNonNegative([1, 1, -4, 1]) AS res
│ [1,2,0,1] │
└───────────┘
-### arraySort(\[func,\] arr1, …) {#arraysortfunc-arr1}
+### arraySort(\[func,\] arr1, ...) {#arraysortfunc-arr1}
返回升序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。
@@ -124,7 +124,7 @@ SELECT arraySort([1, nan, 2, NULL, 3, nan, 4, NULL])
│ [1,2,3,4,nan,nan,NULL,NULL] │
└───────────────────────────────────────────────┘
-### arrayReverseSort(\[func,\] arr1, …) {#arrayreversesortfunc-arr1}
+### arrayReverseSort(\[func,\] arr1, ...) {#arrayreversesortfunc-arr1}
返回降序排序`arr1`的结果。如果指定了`func`函数,则排序顺序由`func`的结果决定。
diff --git a/docs/zh/sql-reference/functions/in-functions.md b/docs/zh/sql-reference/functions/in-functions.md
index 346e076310e..9858159a495 100644
--- a/docs/zh/sql-reference/functions/in-functions.md
+++ b/docs/zh/sql-reference/functions/in-functions.md
@@ -10,10 +10,10 @@ sidebar_label: IN 运算符
请参阅[IN 运算符](../../sql-reference/operators/in.md#select-in-operators)部分。
-## tuple(x, y, …), 运算符 (x, y, …) {#tuplex-y-operator-x-y}
+## tuple(x, y, ...), 运算符 (x, y, ...) {#tuplex-y-operator-x-y}
函数用于对多个列进行分组。
-对于具有类型T1,T2,…的列,它返回包含这些列的元组(T1,T2,…)。 执行该函数没有任何成本。
+对于具有类型T1,T2,...的列,它返回包含这些列的元组(T1,T2,...)。 执行该函数没有任何成本。
元组通常用作IN运算符的中间参数值,或用于创建lambda函数的形参列表。 元组不能写入表。
## tupleElement(tuple, n), 运算符 x.N {#tupleelementtuple-n-operator-x-n}
diff --git a/docs/zh/sql-reference/functions/json-functions.md b/docs/zh/sql-reference/functions/json-functions.md
index 52ec0ed1535..f07de564847 100644
--- a/docs/zh/sql-reference/functions/json-functions.md
+++ b/docs/zh/sql-reference/functions/json-functions.md
@@ -56,7 +56,7 @@ slug: /zh/sql-reference/functions/json-functions
以下函数基于[simdjson](https://github.com/lemire/simdjson),专为更复杂的JSON解析要求而设计。但上述假设2仍然适用。
-## JSONHas(json\[, indices_or_keys\]…) {#jsonhasjson-indices-or-keys}
+## JSONHas(json\[, indices_or_keys\]...) {#jsonhasjson-indices-or-keys}
如果JSON中存在该值,则返回`1`。
@@ -83,7 +83,7 @@ slug: /zh/sql-reference/functions/json-functions
select JSONExtractKey('{"a": "hello", "b": [-100, 200.0, 300]}', -2) = 'a'
select JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 1) = 'hello'
-## JSONLength(json\[, indices_or_keys\]…) {#jsonlengthjson-indices-or-keys}
+## JSONLength(json\[, indices_or_keys\]...) {#jsonlengthjson-indices-or-keys}
返回JSON数组或JSON对象的长度。
@@ -94,7 +94,7 @@ slug: /zh/sql-reference/functions/json-functions
select JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 3
select JSONLength('{"a": "hello", "b": [-100, 200.0, 300]}') = 2
-## JSONType(json\[, indices_or_keys\]…) {#jsontypejson-indices-or-keys}
+## JSONType(json\[, indices_or_keys\]...) {#jsontypejson-indices-or-keys}
返回JSON值的类型。
@@ -106,13 +106,13 @@ slug: /zh/sql-reference/functions/json-functions
select JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') = 'String'
select JSONType('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') = 'Array'
-## JSONExtractUInt(json\[, indices_or_keys\]…) {#jsonextractuintjson-indices-or-keys}
+## JSONExtractUInt(json\[, indices_or_keys\]...) {#jsonextractuintjson-indices-or-keys}
-## JSONExtractInt(json\[, indices_or_keys\]…) {#jsonextractintjson-indices-or-keys}
+## JSONExtractInt(json\[, indices_or_keys\]...) {#jsonextractintjson-indices-or-keys}
-## JSONExtractFloat(json\[, indices_or_keys\]…) {#jsonextractfloatjson-indices-or-keys}
+## JSONExtractFloat(json\[, indices_or_keys\]...) {#jsonextractfloatjson-indices-or-keys}
-## JSONExtractBool(json\[, indices_or_keys\]…) {#jsonextractbooljson-indices-or-keys}
+## JSONExtractBool(json\[, indices_or_keys\]...) {#jsonextractbooljson-indices-or-keys}
解析JSON并提取值。这些函数类似于`visitParam*`函数。
@@ -124,7 +124,7 @@ slug: /zh/sql-reference/functions/json-functions
select JSONExtractFloat('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', 2) = 200.0
select JSONExtractUInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', -1) = 300
-## JSONExtractString(json\[, indices_or_keys\]…) {#jsonextractstringjson-indices-or-keys}
+## JSONExtractString(json\[, indices_or_keys\]...) {#jsonextractstringjson-indices-or-keys}
解析JSON并提取字符串。此函数类似于`visitParamExtractString`函数。
@@ -140,11 +140,11 @@ slug: /zh/sql-reference/functions/json-functions
select JSONExtractString('{"abc":"\\u263"}', 'abc') = ''
select JSONExtractString('{"abc":"hello}', 'abc') = ''
-## JSONExtract(json\[, indices_or_keys…\], Return_type) {#jsonextractjson-indices-or-keys-return-type}
+## JSONExtract(json\[, indices_or_keys...\], Return_type) {#jsonextractjson-indices-or-keys-return-type}
解析JSON并提取给定ClickHouse数据类型的值。
-这是以前的`JSONExtract函数的变体。 这意味着`JSONExtract(…, ‘String’)`返回与`JSONExtractString()`返回完全相同。`JSONExtract(…, ‘Float64’)`返回于`JSONExtractFloat()\`返回完全相同。
+这是以前的`JSONExtract函数的变体。 这意味着`JSONExtract(..., ‘String’)`返回与`JSONExtractString()`返回完全相同。`JSONExtract(..., ‘Float64’)`返回于`JSONExtractFloat()\`返回完全相同。
示例:
@@ -156,7 +156,7 @@ slug: /zh/sql-reference/functions/json-functions
SELECT JSONExtract('{"day": "Thursday"}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday\' = 1, \'Tuesday\' = 2, \'Wednesday\' = 3, \'Thursday\' = 4, \'Friday\' = 5, \'Saturday\' = 6)') = 'Thursday'
SELECT JSONExtract('{"day": 5}', 'day', 'Enum8(\'Sunday\' = 0, \'Monday\' = 1, \'Tuesday\' = 2, \'Wednesday\' = 3, \'Thursday\' = 4, \'Friday\' = 5, \'Saturday\' = 6)') = 'Friday'
-## JSONExtractKeysAndValues(json\[, indices_or_keys…\], Value_type) {#jsonextractkeysandvaluesjson-indices-or-keys-value-type}
+## JSONExtractKeysAndValues(json\[, indices_or_keys...\], Value_type) {#jsonextractkeysandvaluesjson-indices-or-keys-value-type}
从JSON中解析键值对,其中值是给定的ClickHouse数据类型。
@@ -164,7 +164,7 @@ slug: /zh/sql-reference/functions/json-functions
SELECT JSONExtractKeysAndValues('{"x": {"a": 5, "b": 7, "c": 11}}', 'x', 'Int8') = [('a',5),('b',7),('c',11)];
-## JSONExtractRaw(json\[, indices_or_keys\]…) {#jsonextractrawjson-indices-or-keys}
+## JSONExtractRaw(json\[, indices_or_keys\]...) {#jsonextractrawjson-indices-or-keys}
返回JSON的部分。
diff --git a/docs/zh/sql-reference/functions/other-functions.md b/docs/zh/sql-reference/functions/other-functions.md
index 2eeaad63694..9c28ff867c5 100644
--- a/docs/zh/sql-reference/functions/other-functions.md
+++ b/docs/zh/sql-reference/functions/other-functions.md
@@ -90,7 +90,7 @@ SELECT 'some-file-name' AS a, basename(a)
将一个常量列变为一个非常量列。
在ClickHouse中,非常量列和常量列在内存中的表示方式不同。尽管函数对于常量列和非常量总是返回相同的结果,但它们的工作方式可能完全不同(执行不同的代码)。此函数用于调试这种行为。
-## ignore(…) {#ignore}
+## ignore(...) {#ignore}
接受任何参数,包括`NULL`。始终返回0。
但是,函数的参数总是被计算的。该函数可以用于基准测试。
diff --git a/docs/zh/sql-reference/functions/string-functions.md b/docs/zh/sql-reference/functions/string-functions.md
index d1914839d7c..c28735c7dc7 100644
--- a/docs/zh/sql-reference/functions/string-functions.md
+++ b/docs/zh/sql-reference/functions/string-functions.md
@@ -95,7 +95,7 @@ SELECT toValidUTF8('\x61\xF0\x80\x80\x80b')
以Unicode字符为单位反转UTF-8编码的字符串。如果字符串不是UTF-8编码,则可能获取到一个非预期的结果(不会抛出异常)。
-## format(pattern, s0, s1, …) {#formatpattern-s0-s1}
+## format(pattern, s0, s1, ...) {#formatpattern-s0-s1}
使用常量字符串`pattern`格式化其他参数。`pattern`字符串中包含由大括号`{}`包围的«替换字段»。 未被包含在大括号中的任何内容都被视为文本内容,它将原样保留在返回值中。 如果你需要在文本内容中包含一个大括号字符,它可以通过加倍来转义:`{{ '{{' }}`和`{{ '{{' }} '}}' }}`。 字段名称可以是数字(从零开始)或空(然后将它们视为连续数字)
@@ -113,11 +113,11 @@ SELECT format('{} {}', 'Hello', 'World')
└───────────────────────────────────┘
```
-## concat(s1, s2, …) {#concat-s1-s2}
+## concat(s1, s2, ...) {#concat-s1-s2}
将参数中的多个字符串拼接,不带分隔符。
-## concatAssumeInjective(s1, s2, …) {#concatassumeinjectives1-s2}
+## concatAssumeInjective(s1, s2, ...) {#concatassumeinjectives1-s2}
与[concat](#concat-s1-s2)相同,区别在于,你需要保证concat(s1, s2, s3) -\> s4是单射的,它将用于GROUP BY的优化。
diff --git a/docs/zh/sql-reference/functions/string-search-functions.md b/docs/zh/sql-reference/functions/string-search-functions.md
index 972fd84e2a1..8ada76eeeda 100644
--- a/docs/zh/sql-reference/functions/string-search-functions.md
+++ b/docs/zh/sql-reference/functions/string-search-functions.md
@@ -204,7 +204,7 @@ SELECT multiSearchAllPositions('Hello, World!', ['hello', '!', 'world']);
**语法**
```sql
-multiSearchFirstPosition(haystack, [needle1, needle2, …, needleN])
+multiSearchFirstPosition(haystack, [needle1, needle2, ..., needleN])
```
## multiSearchFirstIndex
@@ -216,7 +216,7 @@ multiSearchFirstPosition(haystack, [needle1, needle2, …, needleN])
**语法**
```sql
-multiSearchFirstIndex(haystack, \[needle1, needle2, …, needlen\])
+multiSearchFirstIndex(haystack, \[needle1, needle2, ..., needlen\])
```
## multiSearchAny {#multisearchany}
@@ -229,7 +229,7 @@ multiSearchFirstIndex(haystack, \[needle1, needle2, …, n
**语法**
```sql
-multiSearchAny(haystack, [needle1, needle2, …, needleN])
+multiSearchAny(haystack, [needle1, needle2, ..., needleN])
```
## match {#match}
@@ -273,7 +273,7 @@ Hyperscan 通常容易受到正则表达式拒绝服务 (ReDoS) 攻击。有关
**语法**
```sql
-multiMatchAny(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAny(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiMatchAnyIndex
@@ -283,7 +283,7 @@ multiMatchAny(haystack, \[pattern1, pattern2, …, pattern
**语法**
```sql
-multiMatchAnyIndex(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAnyIndex(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiMatchAllIndices
@@ -293,7 +293,7 @@ multiMatchAnyIndex(haystack, \[pattern1, pattern2, …, pa
**语法**
```sql
-multiMatchAllIndices(haystack, \[pattern1, pattern2, …, patternn\])
+multiMatchAllIndices(haystack, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAny
@@ -307,7 +307,7 @@ multiMatchAllIndices(haystack, \[pattern1, pattern2, …,
**语法**
```sql
-multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, …, patternn\])
+multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAnyIndex
@@ -317,7 +317,7 @@ multiFuzzyMatchAny(haystack, distance, \[pattern1, pattern21, pattern2, …, patternn\])
+multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## multiFuzzyMatchAllIndices
@@ -327,7 +327,7 @@ multiFuzzyMatchAnyIndex(haystack, distance, \[pattern1, pattern2
**语法**
```sql
-multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, …, patternn\])
+multiFuzzyMatchAllIndices(haystack, distance, \[pattern1, pattern2, ..., patternn\])
```
## extract
diff --git a/docs/zh/sql-reference/functions/url-functions.md b/docs/zh/sql-reference/functions/url-functions.md
index 44880b6ca1a..e7a0354c0bf 100644
--- a/docs/zh/sql-reference/functions/url-functions.md
+++ b/docs/zh/sql-reference/functions/url-functions.md
@@ -11,7 +11,7 @@ slug: /zh/sql-reference/functions/url-functions
### 协议 {#protocol}
-返回URL的协议。例如: http、ftp、mailto、magnet…
+返回URL的协议。例如: http、ftp、mailto、magnet...
### 域 {#domain}
diff --git a/docs/zh/sql-reference/statements/alter/delete.md b/docs/zh/sql-reference/statements/alter/delete.md
index 5eb77c35a93..f0b41c4e214 100644
--- a/docs/zh/sql-reference/statements/alter/delete.md
+++ b/docs/zh/sql-reference/statements/alter/delete.md
@@ -4,7 +4,7 @@ sidebar_position: 39
sidebar_label: DELETE
---
-# ALTER TABLE … DELETE 语句 {#alter-mutations}
+# ALTER TABLE ... DELETE 语句 {#alter-mutations}
``` sql
ALTER TABLE [db.]table [ON CLUSTER cluster] DELETE WHERE filter_expr
diff --git a/docs/zh/sql-reference/statements/alter/index.md b/docs/zh/sql-reference/statements/alter/index.md
index e173837a16c..2286dcccd13 100644
--- a/docs/zh/sql-reference/statements/alter/index.md
+++ b/docs/zh/sql-reference/statements/alter/index.md
@@ -38,7 +38,7 @@ sidebar_label: ALTER
## Mutations 突变 {#mutations}
-用来操作表数据的ALTER查询是通过一种叫做“突变”的机制来实现的,最明显的是[ALTER TABLE … DELETE](../../../sql-reference/statements/alter/delete.md)和[ALTER TABLE … UPDATE](../../../sql-reference/statements/alter/update.md)。它们是异步的后台进程,类似于[MergeTree](../../../engines/table-engines/mergetree-family/index.md)表的合并,产生新的“突变”版本的部件。
+用来操作表数据的ALTER查询是通过一种叫做“突变”的机制来实现的,最明显的是[ALTER TABLE ... DELETE](../../../sql-reference/statements/alter/delete.md)和[ALTER TABLE ... UPDATE](../../../sql-reference/statements/alter/update.md)。它们是异步的后台进程,类似于[MergeTree](../../../engines/table-engines/mergetree-family/index.md)表的合并,产生新的“突变”版本的部件。
diff --git a/docs/zh/sql-reference/statements/alter/update.md b/docs/zh/sql-reference/statements/alter/update.md
index 97b2b43d889..7cf37401dc5 100644
--- a/docs/zh/sql-reference/statements/alter/update.md
+++ b/docs/zh/sql-reference/statements/alter/update.md
@@ -4,7 +4,7 @@ sidebar_position: 40
sidebar_label: UPDATE
---
-# ALTER TABLE … UPDATE 语句 {#alter-table-update-statements}
+# ALTER TABLE ... UPDATE 语句 {#alter-table-update-statements}
``` sql
ALTER TABLE [db.]table UPDATE column1 = expr1 [, ...] WHERE filter_expr
diff --git a/docs/zh/sql-reference/statements/alter/view.md b/docs/zh/sql-reference/statements/alter/view.md
index 34a612803c1..a19d918612a 100644
--- a/docs/zh/sql-reference/statements/alter/view.md
+++ b/docs/zh/sql-reference/statements/alter/view.md
@@ -4,9 +4,9 @@ sidebar_position: 50
sidebar_label: VIEW
---
-# ALTER TABLE … MODIFY QUERY 语句 {#alter-modify-query}
+# ALTER TABLE ... MODIFY QUERY 语句 {#alter-modify-query}
-当使用`ALTER TABLE … MODIFY QUERY`语句创建一个[物化视图](../create/view.md#materialized)时,可以修改`SELECT`查询。当物化视图在没有 `TO [db.]name` 的情况下创建时使用它。必须启用 `allow_experimental_alter_materialized_view_structure`设置。
+当使用`ALTER TABLE ... MODIFY QUERY`语句创建一个[物化视图](../create/view.md#materialized)时,可以修改`SELECT`查询。当物化视图在没有 `TO [db.]name` 的情况下创建时使用它。必须启用 `allow_experimental_alter_materialized_view_structure`设置。
如果一个物化视图使用`TO [db.]name`,你必须先 [DETACH](../detach.mdx) 视图。用[ALTER TABLE](index.md)修改目标表,然后 [ATTACH](../attach.mdx)之前分离的(`DETACH`)视图。
diff --git a/docs/zh/sql-reference/statements/create/view.md b/docs/zh/sql-reference/statements/create/view.md
index bce0994ecd2..49a1d66bdf1 100644
--- a/docs/zh/sql-reference/statements/create/view.md
+++ b/docs/zh/sql-reference/statements/create/view.md
@@ -55,7 +55,7 @@ ClickHouse 中的物化视图更像是插入触发器。 如果视图查询中
如果指定`POPULATE`,则在创建视图时将现有表数据插入到视图中,就像创建一个`CREATE TABLE ... AS SELECT ...`一样。 否则,查询仅包含创建视图后插入表中的数据。 我们**不建议**使用POPULATE,因为在创建视图期间插入表中的数据不会插入其中。
-`SELECT` 查询可以包含`DISTINCT`、`GROUP BY`、`ORDER BY`、`LIMIT`……请注意,相应的转换是在每个插入数据块上独立执行的。 例如,如果设置了`GROUP BY`,则在插入期间聚合数据,但仅在插入数据的单个数据包内。 数据不会被进一步聚合。 例外情况是使用独立执行数据聚合的`ENGINE`,例如`SummingMergeTree`。
+`SELECT` 查询可以包含`DISTINCT`、`GROUP BY`、`ORDER BY`、`LIMIT`...请注意,相应的转换是在每个插入数据块上独立执行的。 例如,如果设置了`GROUP BY`,则在插入期间聚合数据,但仅在插入数据的单个数据包内。 数据不会被进一步聚合。 例外情况是使用独立执行数据聚合的`ENGINE`,例如`SummingMergeTree`。
在物化视图上执行[ALTER](../../../sql-reference/statements/alter/index.md)查询有局限性,因此可能不方便。 如果物化视图使用构造`TO [db.]name`,你可以`DETACH`视图,为目标表运行`ALTER`,然后`ATTACH`先前分离的(`DETACH`)视图。
diff --git a/docs/zh/sql-reference/statements/insert-into.md b/docs/zh/sql-reference/statements/insert-into.md
index f80c0a8a8ea..a08a78b6f1d 100644
--- a/docs/zh/sql-reference/statements/insert-into.md
+++ b/docs/zh/sql-reference/statements/insert-into.md
@@ -68,7 +68,7 @@ SELECT * FROM insert_select_testtable;
INSERT INTO [db.]table [(c1, c2, c3)] FORMAT format_name data_set
```
-例如,下面的查询所使用的输入格式就与上面INSERT … VALUES的中使用的输入格式相同:
+例如,下面的查询所使用的输入格式就与上面INSERT ... VALUES的中使用的输入格式相同:
``` sql
INSERT INTO [TABLE] [db.]table [(c1, c2, c3)] FORMAT Values (v11, v12, v13), (v21, v22, v23), ...
diff --git a/docs/zh/sql-reference/statements/select/limit.md b/docs/zh/sql-reference/statements/select/limit.md
index 2bbf2949707..795f3f4ecd1 100644
--- a/docs/zh/sql-reference/statements/select/limit.md
+++ b/docs/zh/sql-reference/statements/select/limit.md
@@ -13,11 +13,11 @@ sidebar_label: LIMIT
如果没有 [ORDER BY](../../../sql-reference/statements/select/order-by.md) 子句显式排序结果,结果的行选择可能是任意的和非确定性的。
-## LIMIT … WITH TIES 修饰符 {#limit-with-ties}
+## LIMIT ... WITH TIES 修饰符 {#limit-with-ties}
如果为 `LIMIT n[,m]` 设置了 `WITH TIES` ,并且声明了 `ORDER BY expr_list`, 除了得到无修饰符的结果(正常情况下的 `limit n`, 前n行数据), 还会返回与第`n`行具有相同排序字段的行(即如果第n+1行的字段与第n行 拥有相同的排序字段,同样返回该结果.
-此修饰符可以与: [ORDER BY … WITH FILL modifier](../../../sql-reference/statements/select/order-by.md#orderby-with-fill) 组合使用.
+此修饰符可以与: [ORDER BY ... WITH FILL modifier](../../../sql-reference/statements/select/order-by.md#orderby-with-fill) 组合使用.
例如以下查询:
diff --git a/docs/zh/sql-reference/statements/select/order-by.md b/docs/zh/sql-reference/statements/select/order-by.md
index 3286fc9f9e7..2f2d9a4959c 100644
--- a/docs/zh/sql-reference/statements/select/order-by.md
+++ b/docs/zh/sql-reference/statements/select/order-by.md
@@ -89,7 +89,7 @@ SELECT a, b, c FROM t ORDER BY a, b, c
## ORDER BY Expr WITH FILL Modifier {#orderby-with-fill}
-此修饰符可以与 [LIMIT … WITH TIES modifier](../../../sql-reference/statements/select/limit.md#limit-with-ties) 进行组合使用.
+此修饰符可以与 [LIMIT ... WITH TIES modifier](../../../sql-reference/statements/select/limit.md#limit-with-ties) 进行组合使用.
可以在`ORDER BY expr`之后用可选的`FROM expr`,`TO expr`和`STEP expr`参数来设置`WITH FILL`修饰符。
所有`expr`列的缺失值将被顺序填充,而其他列将被填充为默认值。
diff --git a/docs/zh/sql-reference/table-functions/file.md b/docs/zh/sql-reference/table-functions/file.md
index 28682255738..fa1ec12f7df 100644
--- a/docs/zh/sql-reference/table-functions/file.md
+++ b/docs/zh/sql-reference/table-functions/file.md
@@ -114,7 +114,7 @@ FROM file('{some,another}_dir/*', 'TSV', 'name String, value UInt32')
**示例**
-从名为 `file000`, `file001`, … , `file999`的文件中查询数据:
+从名为 `file000`, `file001`, ... , `file999`的文件中查询数据:
``` sql
SELECT count(*)
diff --git a/docs/zh/sql-reference/table-functions/hdfs.md b/docs/zh/sql-reference/table-functions/hdfs.md
index b10b10ae2d2..f8320d8d0bb 100644
--- a/docs/zh/sql-reference/table-functions/hdfs.md
+++ b/docs/zh/sql-reference/table-functions/hdfs.md
@@ -84,7 +84,7 @@ FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value U
**示例**
-从名为 `file000`, `file001`, … , `file999`的文件中查询数据:
+从名为 `file000`, `file001`, ... , `file999`的文件中查询数据:
``` sql
SELECT count(*)
diff --git a/docs/zh/sql-reference/table-functions/s3.md b/docs/zh/sql-reference/table-functions/s3.md
index f7384a7526e..4f2c7299d95 100644
--- a/docs/zh/sql-reference/table-functions/s3.md
+++ b/docs/zh/sql-reference/table-functions/s3.md
@@ -99,7 +99,7 @@ FROM s3('https://storage.yandexcloud.net/my-test-bucket-768/{some,another}_prefi
!!! warning "Warning"
如果文件列表中包含有从零开头的数字范围,请对每个数字分别使用带括号的结构,或者使用`?`。
-计算名为 `file-000.csv`, `file-001.csv`, … , `file-999.csv` 文件的总行数:
+计算名为 `file-000.csv`, `file-001.csv`, ... , `file-999.csv` 文件的总行数:
``` sql
SELECT count(*)
diff --git a/programs/client/Client.cpp b/programs/client/Client.cpp
index 01ed7d70b38..efe23d57478 100644
--- a/programs/client/Client.cpp
+++ b/programs/client/Client.cpp
@@ -1178,7 +1178,7 @@ void Client::processConfig()
pager = config().getString("pager", "");
- setDefaultFormatsFromConfiguration();
+ setDefaultFormatsAndCompressionFromConfiguration();
global_context->setClientName(std::string(DEFAULT_CLIENT_NAME));
global_context->setQueryKindInitial();
diff --git a/programs/keeper/Keeper.cpp b/programs/keeper/Keeper.cpp
index 267b725b02b..dba5c2b7d2a 100644
--- a/programs/keeper/Keeper.cpp
+++ b/programs/keeper/Keeper.cpp
@@ -182,6 +182,11 @@ std::string Keeper::getDefaultConfigFileName() const
return "keeper_config.xml";
}
+bool Keeper::allowTextLog() const
+{
+ return false;
+}
+
void Keeper::handleCustomArguments(const std::string & arg, [[maybe_unused]] const std::string & value) // NOLINT
{
if (arg == "force-recovery")
diff --git a/programs/keeper/Keeper.h b/programs/keeper/Keeper.h
index f889ffa595b..c449c40b610 100644
--- a/programs/keeper/Keeper.h
+++ b/programs/keeper/Keeper.h
@@ -65,6 +65,8 @@ protected:
std::string getDefaultConfigFileName() const override;
+ bool allowTextLog() const override;
+
private:
Poco::Net::SocketAddress socketBindListen(Poco::Net::ServerSocket & socket, const std::string & host, UInt16 port, [[maybe_unused]] bool secure = false) const;
diff --git a/programs/library-bridge/LibraryBridgeHandlers.h b/programs/library-bridge/LibraryBridgeHandlers.h
index 1db71eb24cb..62fbf2caede 100644
--- a/programs/library-bridge/LibraryBridgeHandlers.h
+++ b/programs/library-bridge/LibraryBridgeHandlers.h
@@ -23,7 +23,7 @@ public:
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
private:
- static constexpr inline auto FORMAT = "RowBinary";
+ static constexpr auto FORMAT = "RowBinary";
const size_t keep_alive_timeout;
LoggerPtr log;
diff --git a/programs/local/LocalServer.cpp b/programs/local/LocalServer.cpp
index 6d1ebf8d30c..4d5cfb09e6a 100644
--- a/programs/local/LocalServer.cpp
+++ b/programs/local/LocalServer.cpp
@@ -607,7 +607,7 @@ void LocalServer::processConfig()
if (config().has("macros"))
global_context->setMacros(std::make_unique(config(), "macros", log));
- setDefaultFormatsFromConfiguration();
+ setDefaultFormatsAndCompressionFromConfiguration();
/// Sets external authenticators config (LDAP, Kerberos).
global_context->setExternalAuthenticatorsConfig(config());
diff --git a/programs/server/MetricsTransmitter.h b/programs/server/MetricsTransmitter.h
index 23420117b56..24069a60071 100644
--- a/programs/server/MetricsTransmitter.h
+++ b/programs/server/MetricsTransmitter.h
@@ -56,10 +56,10 @@ private:
std::condition_variable cond;
std::optional thread;
- static inline constexpr auto profile_events_path_prefix = "ClickHouse.ProfileEvents.";
- static inline constexpr auto profile_events_cumulative_path_prefix = "ClickHouse.ProfileEventsCumulative.";
- static inline constexpr auto current_metrics_path_prefix = "ClickHouse.Metrics.";
- static inline constexpr auto asynchronous_metrics_path_prefix = "ClickHouse.AsynchronousMetrics.";
+ static constexpr auto profile_events_path_prefix = "ClickHouse.ProfileEvents.";
+ static constexpr auto profile_events_cumulative_path_prefix = "ClickHouse.ProfileEventsCumulative.";
+ static constexpr auto current_metrics_path_prefix = "ClickHouse.Metrics.";
+ static constexpr auto asynchronous_metrics_path_prefix = "ClickHouse.AsynchronousMetrics.";
};
}
diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp
index 9c9476d1aa7..223bc1f77e7 100644
--- a/programs/server/Server.cpp
+++ b/programs/server/Server.cpp
@@ -1476,6 +1476,8 @@ try
global_context->setMaxTableSizeToDrop(new_server_settings.max_table_size_to_drop);
global_context->setMaxPartitionSizeToDrop(new_server_settings.max_partition_size_to_drop);
global_context->setMaxTableNumToWarn(new_server_settings.max_table_num_to_warn);
+ global_context->setMaxViewNumToWarn(new_server_settings.max_view_num_to_warn);
+ global_context->setMaxDictionaryNumToWarn(new_server_settings.max_dictionary_num_to_warn);
global_context->setMaxDatabaseNumToWarn(new_server_settings.max_database_num_to_warn);
global_context->setMaxPartNumToWarn(new_server_settings.max_part_num_to_warn);
diff --git a/src/AggregateFunctions/AggregateFunctionGroupArray.cpp b/src/AggregateFunctions/AggregateFunctionGroupArray.cpp
index d4fb7afcb78..c21b1d376d9 100644
--- a/src/AggregateFunctions/AggregateFunctionGroupArray.cpp
+++ b/src/AggregateFunctions/AggregateFunctionGroupArray.cpp
@@ -753,10 +753,11 @@ size_t getMaxArraySize()
return 0xFFFFFF;
}
-bool hasLimitArraySize()
+bool discardOnLimitReached()
{
if (auto context = Context::getGlobalContextInstance())
- return context->getServerSettings().aggregate_function_group_array_has_limit_size;
+ return context->getServerSettings().aggregate_function_group_array_action_when_limit_is_reached
+ == GroupArrayActionWhenLimitReached::DISCARD;
return false;
}
@@ -767,7 +768,7 @@ AggregateFunctionPtr createAggregateFunctionGroupArray(
{
assertUnary(name, argument_types);
- bool limit_size = hasLimitArraySize();
+ bool has_limit = discardOnLimitReached();
UInt64 max_elems = getMaxArraySize();
if (parameters.empty())
@@ -784,14 +785,14 @@ AggregateFunctionPtr createAggregateFunctionGroupArray(
(type == Field::Types::UInt64 && parameters[0].get() == 0))
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Parameter for aggregate function {} should be positive number", name);
- limit_size = true;
+ has_limit = true;
max_elems = parameters[0].get();
}
else
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
"Incorrect number of parameters for aggregate function {}, should be 0 or 1", name);
- if (!limit_size)
+ if (!has_limit)
{
if (Tlast)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "groupArrayLast make sense only with max_elems (groupArrayLast(max_elems)())");
diff --git a/src/AggregateFunctions/AggregateFunctionSequenceNextNode.cpp b/src/AggregateFunctions/AggregateFunctionSequenceNextNode.cpp
index bed10333af0..b3824720b04 100644
--- a/src/AggregateFunctions/AggregateFunctionSequenceNextNode.cpp
+++ b/src/AggregateFunctions/AggregateFunctionSequenceNextNode.cpp
@@ -341,7 +341,7 @@ public:
value[i] = Node::read(buf, arena);
}
- inline std::optional getBaseIndex(Data & data) const
+ std::optional getBaseIndex(Data & data) const
{
if (data.value.size() == 0)
return {};
diff --git a/src/AggregateFunctions/Combinators/AggregateFunctionIf.cpp b/src/AggregateFunctions/Combinators/AggregateFunctionIf.cpp
index 9b5ee79a533..3e21ffa3418 100644
--- a/src/AggregateFunctions/Combinators/AggregateFunctionIf.cpp
+++ b/src/AggregateFunctions/Combinators/AggregateFunctionIf.cpp
@@ -73,7 +73,7 @@ private:
using Base = AggregateFunctionNullBase>;
- inline bool singleFilter(const IColumn ** columns, size_t row_num) const
+ bool singleFilter(const IColumn ** columns, size_t row_num) const
{
const IColumn * filter_column = columns[num_arguments - 1];
@@ -261,7 +261,7 @@ public:
filter_is_only_null = arguments.back()->onlyNull();
}
- static inline bool singleFilter(const IColumn ** columns, size_t row_num, size_t num_arguments)
+ static bool singleFilter(const IColumn ** columns, size_t row_num, size_t num_arguments)
{
return assert_cast(*columns[num_arguments - 1]).getData()[row_num];
}
diff --git a/src/AggregateFunctions/QuantileTDigest.h b/src/AggregateFunctions/QuantileTDigest.h
index 9d84f079daa..d5a4f6b576a 100644
--- a/src/AggregateFunctions/QuantileTDigest.h
+++ b/src/AggregateFunctions/QuantileTDigest.h
@@ -138,7 +138,7 @@ class QuantileTDigest
compress();
}
- inline bool canBeMerged(const BetterFloat & l_mean, const Value & r_mean)
+ bool canBeMerged(const BetterFloat & l_mean, const Value & r_mean)
{
return l_mean == r_mean || (!std::isinf(l_mean) && !std::isinf(r_mean));
}
diff --git a/src/AggregateFunctions/QuantileTiming.h b/src/AggregateFunctions/QuantileTiming.h
index 45fbf38258f..eef15828fc0 100644
--- a/src/AggregateFunctions/QuantileTiming.h
+++ b/src/AggregateFunctions/QuantileTiming.h
@@ -262,7 +262,7 @@ namespace detail
UInt64 count_big[BIG_SIZE];
/// Get value of quantile by index in array `count_big`.
- static inline UInt16 indexInBigToValue(size_t i)
+ static UInt16 indexInBigToValue(size_t i)
{
return (i * BIG_PRECISION) + SMALL_THRESHOLD
+ (intHash32<0>(i) % BIG_PRECISION - (BIG_PRECISION / 2)); /// A small randomization so that it is not noticeable that all the values are even.
diff --git a/src/AggregateFunctions/ThetaSketchData.h b/src/AggregateFunctions/ThetaSketchData.h
index f32386d945b..99dca27673d 100644
--- a/src/AggregateFunctions/ThetaSketchData.h
+++ b/src/AggregateFunctions/ThetaSketchData.h
@@ -24,14 +24,14 @@ private:
std::unique_ptr sk_update;
std::unique_ptr sk_union;
- inline datasketches::update_theta_sketch * getSkUpdate()
+ datasketches::update_theta_sketch * getSkUpdate()
{
if (!sk_update)
sk_update = std::make_unique(datasketches::update_theta_sketch::builder().build());
return sk_update.get();
}
- inline datasketches::theta_union * getSkUnion()
+ datasketches::theta_union * getSkUnion()
{
if (!sk_union)
sk_union = std::make_unique(datasketches::theta_union::builder().build());
diff --git a/src/AggregateFunctions/UniqVariadicHash.h b/src/AggregateFunctions/UniqVariadicHash.h
index 840380e7f0f..5bb245397d4 100644
--- a/src/AggregateFunctions/UniqVariadicHash.h
+++ b/src/AggregateFunctions/UniqVariadicHash.h
@@ -38,7 +38,7 @@ bool isAllArgumentsContiguousInMemory(const DataTypes & argument_types);
template <>
struct UniqVariadicHash
{
- static inline UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
+ static UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
{
UInt64 hash;
@@ -65,7 +65,7 @@ struct UniqVariadicHash
template <>
struct UniqVariadicHash
{
- static inline UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
+ static UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
{
UInt64 hash;
@@ -94,7 +94,7 @@ struct UniqVariadicHash
template <>
struct UniqVariadicHash
{
- static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
+ static UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
{
const IColumn ** column = columns;
const IColumn ** columns_end = column + num_args;
@@ -114,7 +114,7 @@ struct UniqVariadicHash
template <>
struct UniqVariadicHash
{
- static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
+ static UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
{
const auto & tuple_columns = assert_cast(columns[0])->getColumns();
diff --git a/src/AggregateFunctions/UniquesHashSet.h b/src/AggregateFunctions/UniquesHashSet.h
index d6fc2bb6634..d5241547711 100644
--- a/src/AggregateFunctions/UniquesHashSet.h
+++ b/src/AggregateFunctions/UniquesHashSet.h
@@ -105,14 +105,14 @@ private:
}
}
- inline size_t buf_size() const { return 1ULL << size_degree; } /// NOLINT
- inline size_t max_fill() const { return 1ULL << (size_degree - 1); } /// NOLINT
- inline size_t mask() const { return buf_size() - 1; }
+ size_t buf_size() const { return 1ULL << size_degree; } /// NOLINT
+ size_t max_fill() const { return 1ULL << (size_degree - 1); } /// NOLINT
+ size_t mask() const { return buf_size() - 1; }
- inline size_t place(HashValue x) const { return (x >> UNIQUES_HASH_BITS_FOR_SKIP) & mask(); }
+ size_t place(HashValue x) const { return (x >> UNIQUES_HASH_BITS_FOR_SKIP) & mask(); }
/// The value is divided by 2 ^ skip_degree
- inline bool good(HashValue hash) const { return hash == ((hash >> skip_degree) << skip_degree); }
+ bool good(HashValue hash) const { return hash == ((hash >> skip_degree) << skip_degree); }
HashValue hash(Value key) const { return static_cast(Hash()(key)); }
diff --git a/src/Analyzer/ArrayJoinNode.cpp b/src/Analyzer/ArrayJoinNode.cpp
index 59389d4f2a8..27d7229d46a 100644
--- a/src/Analyzer/ArrayJoinNode.cpp
+++ b/src/Analyzer/ArrayJoinNode.cpp
@@ -24,6 +24,9 @@ void ArrayJoinNode::dumpTreeImpl(WriteBuffer & buffer, FormatState & format_stat
buffer << std::string(indent, ' ') << "ARRAY_JOIN id: " << format_state.getNodeId(this);
buffer << ", is_left: " << is_left;
+ if (hasAlias())
+ buffer << ", alias: " << getAlias();
+
buffer << '\n' << std::string(indent + 2, ' ') << "TABLE EXPRESSION\n";
getTableExpression()->dumpTreeImpl(buffer, format_state, indent + 4);
diff --git a/src/Analyzer/Passes/AggregateFunctionsArithmericOperationsPass.cpp b/src/Analyzer/Passes/AggregateFunctionsArithmericOperationsPass.cpp
index f96ba22eb7a..9153bc4eca2 100644
--- a/src/Analyzer/Passes/AggregateFunctionsArithmericOperationsPass.cpp
+++ b/src/Analyzer/Passes/AggregateFunctionsArithmericOperationsPass.cpp
@@ -173,13 +173,13 @@ private:
return arithmetic_function_clone;
}
- inline void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
+ void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
{
auto function = FunctionFactory::instance().get(function_name, getContext());
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
}
- static inline void resolveAggregateFunctionNode(FunctionNode & function_node, const QueryTreeNodePtr & argument, const String & aggregate_function_name)
+ static void resolveAggregateFunctionNode(FunctionNode & function_node, const QueryTreeNodePtr & argument, const String & aggregate_function_name)
{
auto function_aggregate_function = function_node.getAggregateFunction();
diff --git a/src/Analyzer/Passes/ComparisonTupleEliminationPass.cpp b/src/Analyzer/Passes/ComparisonTupleEliminationPass.cpp
index f8233f473f8..ebefc12ae53 100644
--- a/src/Analyzer/Passes/ComparisonTupleEliminationPass.cpp
+++ b/src/Analyzer/Passes/ComparisonTupleEliminationPass.cpp
@@ -184,7 +184,7 @@ private:
return result_function;
}
- inline QueryTreeNodePtr makeEqualsFunction(QueryTreeNodePtr lhs_argument, QueryTreeNodePtr rhs_argument) const
+ QueryTreeNodePtr makeEqualsFunction(QueryTreeNodePtr lhs_argument, QueryTreeNodePtr rhs_argument) const
{
return makeComparisonFunction(std::move(lhs_argument), std::move(rhs_argument), "equals");
}
diff --git a/src/Analyzer/Passes/ConvertQueryToCNFPass.cpp b/src/Analyzer/Passes/ConvertQueryToCNFPass.cpp
index 96bc62212fd..5951e8fc5ea 100644
--- a/src/Analyzer/Passes/ConvertQueryToCNFPass.cpp
+++ b/src/Analyzer/Passes/ConvertQueryToCNFPass.cpp
@@ -99,6 +99,23 @@ bool checkIfGroupAlwaysTrueGraph(const Analyzer::CNF::OrGroup & group, const Com
return false;
}
+bool checkIfGroupAlwaysTrueAtoms(const Analyzer::CNF::OrGroup & group)
+{
+ /// Filters out groups containing mutually exclusive atoms,
+ /// since these groups are always True
+
+ for (const auto & atom : group)
+ {
+ auto negated(atom);
+ negated.negative = !atom.negative;
+ if (group.contains(negated))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
bool checkIfAtomAlwaysFalseFullMatch(const Analyzer::CNF::AtomicFormula & atom, const ConstraintsDescription::QueryTreeData & query_tree_constraints)
{
const auto constraint_atom_ids = query_tree_constraints.getAtomIds(atom.node_with_hash);
@@ -644,7 +661,8 @@ void optimizeWithConstraints(Analyzer::CNF & cnf, const QueryTreeNodes & table_e
cnf.filterAlwaysTrueGroups([&](const auto & group)
{
/// remove always true groups from CNF
- return !checkIfGroupAlwaysTrueFullMatch(group, query_tree_constraints) && !checkIfGroupAlwaysTrueGraph(group, compare_graph);
+ return !checkIfGroupAlwaysTrueFullMatch(group, query_tree_constraints)
+ && !checkIfGroupAlwaysTrueGraph(group, compare_graph) && !checkIfGroupAlwaysTrueAtoms(group);
})
.filterAlwaysFalseAtoms([&](const Analyzer::CNF::AtomicFormula & atom)
{
diff --git a/src/Analyzer/Passes/FunctionToSubcolumnsPass.cpp b/src/Analyzer/Passes/FunctionToSubcolumnsPass.cpp
index 6248f462979..15ac8d642a4 100644
--- a/src/Analyzer/Passes/FunctionToSubcolumnsPass.cpp
+++ b/src/Analyzer/Passes/FunctionToSubcolumnsPass.cpp
@@ -215,7 +215,7 @@ public:
}
private:
- inline void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
+ void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
{
auto function = FunctionFactory::instance().get(function_name, getContext());
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
diff --git a/src/Analyzer/Passes/NormalizeCountVariantsPass.cpp b/src/Analyzer/Passes/NormalizeCountVariantsPass.cpp
index 0d6f3fc2d87..e70e08e65f4 100644
--- a/src/Analyzer/Passes/NormalizeCountVariantsPass.cpp
+++ b/src/Analyzer/Passes/NormalizeCountVariantsPass.cpp
@@ -59,7 +59,7 @@ public:
}
}
private:
- static inline void resolveAsCountAggregateFunction(FunctionNode & function_node)
+ static void resolveAsCountAggregateFunction(FunctionNode & function_node)
{
AggregateFunctionProperties properties;
auto aggregate_function = AggregateFunctionFactory::instance().get("count", NullsAction::EMPTY, {}, {}, properties);
diff --git a/src/Analyzer/Passes/QueryAnalysisPass.cpp b/src/Analyzer/Passes/QueryAnalysisPass.cpp
index dae17e18b85..43edaaa53fd 100644
--- a/src/Analyzer/Passes/QueryAnalysisPass.cpp
+++ b/src/Analyzer/Passes/QueryAnalysisPass.cpp
@@ -586,6 +586,89 @@ private:
std::unordered_map alias_name_to_expressions;
};
+struct ScopeAliases
+{
+ /// Alias name to query expression node
+ std::unordered_map alias_name_to_expression_node_before_group_by;
+ std::unordered_map alias_name_to_expression_node_after_group_by;
+
+ std::unordered_map * alias_name_to_expression_node = nullptr;
+
+ /// Alias name to lambda node
+ std::unordered_map alias_name_to_lambda_node;
+
+ /// Alias name to table expression node
+ std::unordered_map alias_name_to_table_expression_node;
+
+ /// Expressions like `x as y` where we can't say whether it's a function, expression or table.
+ std::unordered_map transitive_aliases;
+
+ /// Nodes with duplicated aliases
+ std::unordered_set nodes_with_duplicated_aliases;
+ std::vector cloned_nodes_with_duplicated_aliases;
+
+ /// Names which are aliases from ARRAY JOIN.
+ /// This is needed to properly qualify columns from matchers and avoid name collision.
+ std::unordered_set array_join_aliases;
+
+ std::unordered_map & getAliasMap(IdentifierLookupContext lookup_context)
+ {
+ switch (lookup_context)
+ {
+ case IdentifierLookupContext::EXPRESSION: return *alias_name_to_expression_node;
+ case IdentifierLookupContext::FUNCTION: return alias_name_to_lambda_node;
+ case IdentifierLookupContext::TABLE_EXPRESSION: return alias_name_to_table_expression_node;
+ }
+ }
+
+ enum class FindOption
+ {
+ FIRST_NAME,
+ FULL_NAME,
+ };
+
+ const std::string & getKey(const Identifier & identifier, FindOption find_option)
+ {
+ switch (find_option)
+ {
+ case FindOption::FIRST_NAME: return identifier.front();
+ case FindOption::FULL_NAME: return identifier.getFullName();
+ }
+ }
+
+ QueryTreeNodePtr * find(IdentifierLookup lookup, FindOption find_option)
+ {
+ auto & alias_map = getAliasMap(lookup.lookup_context);
+ const std::string * key = &getKey(lookup.identifier, find_option);
+
+ auto it = alias_map.find(*key);
+
+ if (it != alias_map.end())
+ return &it->second;
+
+ if (lookup.lookup_context == IdentifierLookupContext::TABLE_EXPRESSION)
+ return {};
+
+ while (it == alias_map.end())
+ {
+ auto jt = transitive_aliases.find(*key);
+ if (jt == transitive_aliases.end())
+ return {};
+
+ key = &(getKey(jt->second, find_option));
+ it = alias_map.find(*key);
+ }
+
+ return &it->second;
+ }
+
+ const QueryTreeNodePtr * find(IdentifierLookup lookup, FindOption find_option) const
+ {
+ return const_cast(this)->find(lookup, find_option);
+ }
+};
+
+
/** Projection names is name of query tree node that is used in projection part of query node.
* Example: SELECT id FROM test_table;
* `id` is projection name of column node
@@ -731,7 +814,7 @@ struct IdentifierResolveScope
else if (parent_scope)
join_use_nulls = parent_scope->join_use_nulls;
- alias_name_to_expression_node = &alias_name_to_expression_node_before_group_by;
+ aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_before_group_by;
}
QueryTreeNodePtr scope_node;
@@ -746,17 +829,7 @@ struct IdentifierResolveScope
/// Argument can be expression like constant, column, function or table expression
std::unordered_map expression_argument_name_to_node;
- /// Alias name to query expression node
- std::unordered_map alias_name_to_expression_node_before_group_by;
- std::unordered_map alias_name_to_expression_node_after_group_by;
-
- std::unordered_map * alias_name_to_expression_node = nullptr;
-
- /// Alias name to lambda node
- std::unordered_map alias_name_to_lambda_node;
-
- /// Alias name to table expression node
- std::unordered_map alias_name_to_table_expression_node;
+ ScopeAliases aliases;
/// Table column name to column node. Valid only during table ALIAS columns resolve.
ColumnNameToColumnNodeMap column_name_to_column_node;
@@ -767,10 +840,6 @@ struct IdentifierResolveScope
/// Window name to window node
std::unordered_map window_name_to_window_node;
- /// Nodes with duplicated aliases
- std::unordered_set nodes_with_duplicated_aliases;
- std::vector cloned_nodes_with_duplicated_aliases;
-
/// Current scope expression in resolve process stack
ExpressionsStack expressions_in_resolve_process_stack;
@@ -889,7 +958,7 @@ struct IdentifierResolveScope
bool had_aggregate_function = expressions_in_resolve_process_stack.hasAggregateFunction();
expressions_in_resolve_process_stack.push(node);
if (group_by_use_nulls && had_aggregate_function != expressions_in_resolve_process_stack.hasAggregateFunction())
- alias_name_to_expression_node = &alias_name_to_expression_node_before_group_by;
+ aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_before_group_by;
}
void popExpressionNode()
@@ -897,7 +966,7 @@ struct IdentifierResolveScope
bool had_aggregate_function = expressions_in_resolve_process_stack.hasAggregateFunction();
expressions_in_resolve_process_stack.pop();
if (group_by_use_nulls && had_aggregate_function != expressions_in_resolve_process_stack.hasAggregateFunction())
- alias_name_to_expression_node = &alias_name_to_expression_node_after_group_by;
+ aliases.alias_name_to_expression_node = &aliases.alias_name_to_expression_node_after_group_by;
}
/// Dump identifier resolve scope
@@ -916,16 +985,16 @@ struct IdentifierResolveScope
for (const auto & [alias_name, node] : expression_argument_name_to_node)
buffer << "Alias name " << alias_name << " node " << node->formatASTForErrorMessage() << '\n';
- buffer << "Alias name to expression node table size " << alias_name_to_expression_node->size() << '\n';
- for (const auto & [alias_name, node] : *alias_name_to_expression_node)
+ buffer << "Alias name to expression node table size " << aliases.alias_name_to_expression_node->size() << '\n';
+ for (const auto & [alias_name, node] : *aliases.alias_name_to_expression_node)
buffer << "Alias name " << alias_name << " expression node " << node->dumpTree() << '\n';
- buffer << "Alias name to function node table size " << alias_name_to_lambda_node.size() << '\n';
- for (const auto & [alias_name, node] : alias_name_to_lambda_node)
+ buffer << "Alias name to function node table size " << aliases.alias_name_to_lambda_node.size() << '\n';
+ for (const auto & [alias_name, node] : aliases.alias_name_to_lambda_node)
buffer << "Alias name " << alias_name << " lambda node " << node->formatASTForErrorMessage() << '\n';
- buffer << "Alias name to table expression node table size " << alias_name_to_table_expression_node.size() << '\n';
- for (const auto & [alias_name, node] : alias_name_to_table_expression_node)
+ buffer << "Alias name to table expression node table size " << aliases.alias_name_to_table_expression_node.size() << '\n';
+ for (const auto & [alias_name, node] : aliases.alias_name_to_table_expression_node)
buffer << "Alias name " << alias_name << " node " << node->formatASTForErrorMessage() << '\n';
buffer << "CTE name to query node table size " << cte_name_to_query_node.size() << '\n';
@@ -936,8 +1005,8 @@ struct IdentifierResolveScope
for (const auto & [window_name, node] : window_name_to_window_node)
buffer << "CTE name " << window_name << " node " << node->formatASTForErrorMessage() << '\n';
- buffer << "Nodes with duplicated aliases size " << nodes_with_duplicated_aliases.size() << '\n';
- for (const auto & node : nodes_with_duplicated_aliases)
+ buffer << "Nodes with duplicated aliases size " << aliases.nodes_with_duplicated_aliases.size() << '\n';
+ for (const auto & node : aliases.nodes_with_duplicated_aliases)
buffer << "Alias name " << node->getAlias() << " node " << node->formatASTForErrorMessage() << '\n';
buffer << "Expression resolve process stack " << '\n';
@@ -996,8 +1065,8 @@ struct IdentifierResolveScope
class QueryExpressionsAliasVisitor : public InDepthQueryTreeVisitor
{
public:
- explicit QueryExpressionsAliasVisitor(IdentifierResolveScope & scope_)
- : scope(scope_)
+ explicit QueryExpressionsAliasVisitor(ScopeAliases & aliases_)
+ : aliases(aliases_)
{}
void visitImpl(QueryTreeNodePtr & node)
@@ -1034,10 +1103,10 @@ public:
private:
void addDuplicatingAlias(const QueryTreeNodePtr & node)
{
- scope.nodes_with_duplicated_aliases.emplace(node);
+ aliases.nodes_with_duplicated_aliases.emplace(node);
auto cloned_node = node->clone();
- scope.cloned_nodes_with_duplicated_aliases.emplace_back(cloned_node);
- scope.nodes_with_duplicated_aliases.emplace(cloned_node);
+ aliases.cloned_nodes_with_duplicated_aliases.emplace_back(cloned_node);
+ aliases.nodes_with_duplicated_aliases.emplace(cloned_node);
}
void updateAliasesIfNeeded(const QueryTreeNodePtr & node, bool is_lambda_node)
@@ -1053,29 +1122,29 @@ private:
if (is_lambda_node)
{
- if (scope.alias_name_to_expression_node->contains(alias))
+ if (aliases.alias_name_to_expression_node->contains(alias))
addDuplicatingAlias(node);
- auto [_, inserted] = scope.alias_name_to_lambda_node.insert(std::make_pair(alias, node));
+ auto [_, inserted] = aliases.alias_name_to_lambda_node.insert(std::make_pair(alias, node));
if (!inserted)
addDuplicatingAlias(node);
return;
}
- if (scope.alias_name_to_lambda_node.contains(alias))
- addDuplicatingAlias(node);
+ if (aliases.alias_name_to_lambda_node.contains(alias))
+ addDuplicatingAlias(node);
- auto [_, inserted] = scope.alias_name_to_expression_node->insert(std::make_pair(alias, node));
+ auto [_, inserted] = aliases.alias_name_to_expression_node->insert(std::make_pair(alias, node));
if (!inserted)
- addDuplicatingAlias(node);
+ addDuplicatingAlias(node);
- /// If node is identifier put it also in scope alias name to lambda node map
- if (node->getNodeType() == QueryTreeNodeType::IDENTIFIER)
- scope.alias_name_to_lambda_node.insert(std::make_pair(alias, node));
+ /// If node is identifier put it into transitive aliases map.
+ if (const auto * identifier = typeid_cast(node.get()))
+ aliases.transitive_aliases.insert(std::make_pair(alias, identifier->getIdentifier()));
}
- IdentifierResolveScope & scope;
+ ScopeAliases & aliases;
};
class TableExpressionsAliasVisitor : public InDepthQueryTreeVisitor
@@ -1122,7 +1191,7 @@ private:
return;
const auto & node_alias = node->getAlias();
- auto [_, inserted] = scope.alias_name_to_table_expression_node.emplace(node_alias, node);
+ auto [_, inserted] = scope.aliases.alias_name_to_table_expression_node.emplace(node_alias, node);
if (!inserted)
throw Exception(ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS,
"Multiple table expressions with same alias {}. In scope {}",
@@ -1193,7 +1262,7 @@ public:
}
case QueryTreeNodeType::TABLE_FUNCTION:
{
- QueryExpressionsAliasVisitor expressions_alias_visitor(scope);
+ QueryExpressionsAliasVisitor expressions_alias_visitor(scope.aliases);
resolveTableFunction(node, scope, expressions_alias_visitor, false /*nested_table_function*/);
break;
}
@@ -1461,7 +1530,7 @@ private:
ProjectionNames resolveFunction(QueryTreeNodePtr & function_node, IdentifierResolveScope & scope);
- ProjectionNames resolveExpressionNode(QueryTreeNodePtr & node, IdentifierResolveScope & scope, bool allow_lambda_expression, bool allow_table_expression);
+ ProjectionNames resolveExpressionNode(QueryTreeNodePtr & node, IdentifierResolveScope & scope, bool allow_lambda_expression, bool allow_table_expression, bool ignore_alias = false);
ProjectionNames resolveExpressionNodeList(QueryTreeNodePtr & node_list, IdentifierResolveScope & scope, bool allow_lambda_expression, bool allow_table_expression);
@@ -1868,7 +1937,7 @@ void QueryAnalyzer::collectScopeValidIdentifiersForTypoCorrection(
if (allow_expression_identifiers)
{
- for (const auto & [name, expression] : *scope.alias_name_to_expression_node)
+ for (const auto & [name, expression] : *scope.aliases.alias_name_to_expression_node)
{
assert(expression);
auto expression_identifier = Identifier(name);
@@ -1898,13 +1967,13 @@ void QueryAnalyzer::collectScopeValidIdentifiersForTypoCorrection(
{
if (allow_function_identifiers)
{
- for (const auto & [name, _] : *scope.alias_name_to_expression_node)
+ for (const auto & [name, _] : *scope.aliases.alias_name_to_expression_node)
valid_identifiers_result.insert(Identifier(name));
}
if (allow_table_expression_identifiers)
{
- for (const auto & [name, _] : scope.alias_name_to_table_expression_node)
+ for (const auto & [name, _] : scope.aliases.alias_name_to_table_expression_node)
valid_identifiers_result.insert(Identifier(name));
}
}
@@ -2793,21 +2862,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromExpressionArguments(cons
bool QueryAnalyzer::tryBindIdentifierToAliases(const IdentifierLookup & identifier_lookup, const IdentifierResolveScope & scope)
{
- const auto & identifier_bind_part = identifier_lookup.identifier.front();
-
- auto get_alias_name_to_node_map = [&]() -> const std::unordered_map &
- {
- if (identifier_lookup.isExpressionLookup())
- return *scope.alias_name_to_expression_node;
- else if (identifier_lookup.isFunctionLookup())
- return scope.alias_name_to_lambda_node;
-
- return scope.alias_name_to_table_expression_node;
- };
-
- const auto & alias_name_to_node_map = get_alias_name_to_node_map();
-
- return alias_name_to_node_map.contains(identifier_bind_part);
+ return scope.aliases.find(identifier_lookup, ScopeAliases::FindOption::FIRST_NAME) != nullptr || scope.aliases.array_join_aliases.contains(identifier_lookup.identifier.front());
}
/** Resolve identifier from scope aliases.
@@ -2857,23 +2912,13 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
{
const auto & identifier_bind_part = identifier_lookup.identifier.front();
- auto get_alias_name_to_node_map = [&]() -> std::unordered_map &
- {
- if (identifier_lookup.isExpressionLookup())
- return *scope.alias_name_to_expression_node;
- else if (identifier_lookup.isFunctionLookup())
- return scope.alias_name_to_lambda_node;
-
- return scope.alias_name_to_table_expression_node;
- };
-
- auto & alias_name_to_node_map = get_alias_name_to_node_map();
- auto it = alias_name_to_node_map.find(identifier_bind_part);
-
- if (it == alias_name_to_node_map.end())
+ auto * it = scope.aliases.find(identifier_lookup, ScopeAliases::FindOption::FIRST_NAME);
+ if (it == nullptr)
return {};
- if (!it->second)
+ QueryTreeNodePtr & alias_node = *it;
+
+ if (!alias_node)
throw Exception(ErrorCodes::LOGICAL_ERROR,
"Node with alias {} is not valid. In scope {}",
identifier_bind_part,
@@ -2893,14 +2938,14 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
return {};
}
- auto node_type = it->second->getNodeType();
+ auto node_type = alias_node->getNodeType();
/// Resolve expression if necessary
if (node_type == QueryTreeNodeType::IDENTIFIER)
{
- scope.pushExpressionNode(it->second);
+ scope.pushExpressionNode(alias_node);
- auto & alias_identifier_node = it->second->as();
+ auto & alias_identifier_node = alias_node->as();
auto identifier = alias_identifier_node.getIdentifier();
auto lookup_result = tryResolveIdentifier(IdentifierLookup{identifier, identifier_lookup.lookup_context}, scope, identifier_resolve_settings);
if (!lookup_result.resolved_identifier)
@@ -2916,43 +2961,27 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
getHintsErrorMessageSuffix(hints));
}
- it->second = lookup_result.resolved_identifier;
-
- /** During collection of aliases if node is identifier and has alias, we cannot say if it is
- * column or function node. Check QueryExpressionsAliasVisitor documentation for clarification.
- *
- * If we resolved identifier node as expression, we must remove identifier node alias from
- * function alias map.
- * If we resolved identifier node as function, we must remove identifier node alias from
- * expression alias map.
- */
- if (identifier_lookup.isExpressionLookup())
- scope.alias_name_to_lambda_node.erase(identifier_bind_part);
- else if (identifier_lookup.isFunctionLookup())
- scope.alias_name_to_expression_node->erase(identifier_bind_part);
-
+ alias_node = lookup_result.resolved_identifier;
scope.popExpressionNode();
}
else if (node_type == QueryTreeNodeType::FUNCTION)
{
- resolveExpressionNode(it->second, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
+ resolveExpressionNode(alias_node, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
}
else if (node_type == QueryTreeNodeType::QUERY || node_type == QueryTreeNodeType::UNION)
{
if (identifier_resolve_settings.allow_to_resolve_subquery_during_identifier_resolution)
- resolveExpressionNode(it->second, scope, false /*allow_lambda_expression*/, identifier_lookup.isTableExpressionLookup() /*allow_table_expression*/);
+ resolveExpressionNode(alias_node, scope, false /*allow_lambda_expression*/, identifier_lookup.isTableExpressionLookup() /*allow_table_expression*/);
}
- QueryTreeNodePtr result = it->second;
-
- if (identifier_lookup.identifier.isCompound() && result)
+ if (identifier_lookup.identifier.isCompound() && alias_node)
{
if (identifier_lookup.isExpressionLookup())
{
return tryResolveIdentifierFromCompoundExpression(
identifier_lookup.identifier,
1 /*identifier_bind_size*/,
- it->second,
+ alias_node,
{} /* compound_expression_source */,
scope,
identifier_resolve_settings.allow_to_check_join_tree /* can_be_not_found */);
@@ -2967,7 +2996,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromAliases(const Identifier
}
}
- return result;
+ return alias_node;
}
/** Resolve identifier from table columns.
@@ -3864,12 +3893,40 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromArrayJoin(const Identifi
{
auto & array_join_column_expression_typed = array_join_column_expression->as();
- if (array_join_column_expression_typed.getAlias() == identifier_lookup.identifier.getFullName())
+ IdentifierView identifier_view(identifier_lookup.identifier);
+
+ if (identifier_view.isCompound() && from_array_join_node.hasAlias() && identifier_view.front() == from_array_join_node.getAlias())
+ identifier_view.popFirst();
+
+ const auto & alias_or_name = array_join_column_expression_typed.hasAlias()
+ ? array_join_column_expression_typed.getAlias()
+ : array_join_column_expression_typed.getColumnName();
+
+ if (identifier_view.front() == alias_or_name)
+ identifier_view.popFirst();
+ else if (identifier_view.getFullName() == alias_or_name)
+ identifier_view.popFirst(identifier_view.getPartsSize()); /// Clear
+ else
+ continue;
+
+ if (identifier_view.empty())
{
auto array_join_column = std::make_shared(array_join_column_expression_typed.getColumn(),
array_join_column_expression_typed.getColumnSource());
return array_join_column;
}
+
+ /// Resolve subcolumns. Example : SELECT x.y.z FROM tab ARRAY JOIN arr AS x
+ auto compound_expr = tryResolveIdentifierFromCompoundExpression(
+ identifier_lookup.identifier,
+ identifier_lookup.identifier.getPartsSize() - identifier_view.getPartsSize() /*identifier_bind_size*/,
+ array_join_column_expression,
+ {} /* compound_expression_source */,
+ scope,
+ true /* can_be_not_found */);
+
+ if (compound_expr)
+ return compound_expr;
}
if (!resolved_identifier)
@@ -4128,10 +4185,11 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifier(const IdentifierLook
* SELECT id FROM ( SELECT ... ) AS subquery ARRAY JOIN [0] AS id INNER JOIN second_table USING (id)
* In the example, identifier `id` should be resolved into one from USING (id) column.
*/
- auto alias_it = scope.alias_name_to_expression_node->find(identifier_lookup.identifier.getFullName());
- if (alias_it != scope.alias_name_to_expression_node->end() && alias_it->second->getNodeType() == QueryTreeNodeType::COLUMN)
+
+ auto * alias_it = scope.aliases.find(identifier_lookup, ScopeAliases::FindOption::FULL_NAME);
+ if (alias_it && (*alias_it)->getNodeType() == QueryTreeNodeType::COLUMN)
{
- const auto & column_node = alias_it->second->as();
+ const auto & column_node = (*alias_it)->as();
if (column_node.getColumnSource()->getNodeType() == QueryTreeNodeType::ARRAY_JOIN)
prefer_column_name_to_alias = true;
}
@@ -4617,6 +4675,36 @@ QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::resolveUnqualifiedMatcher(
std::unordered_set table_expression_column_names_to_skip;
+ QueryTreeNodesWithNames result;
+
+ if (matcher_node_typed.getMatcherType() == MatcherNodeType::COLUMNS_LIST)
+ {
+ auto identifiers = matcher_node_typed.getColumnsIdentifiers();
+ result.reserve(identifiers.size());
+
+ for (const auto & identifier : identifiers)
+ {
+ auto resolve_result = tryResolveIdentifier(IdentifierLookup{identifier, IdentifierLookupContext::EXPRESSION}, scope);
+ if (!resolve_result.isResolved())
+ throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER,
+ "Unknown identifier '{}' inside COLUMNS matcher. In scope {}",
+ identifier.getFullName(), scope.dump());
+
+ // TODO: Introduce IdentifierLookupContext::COLUMN and get rid of this check
+ auto * resolved_column = resolve_result.resolved_identifier->as();
+ if (!resolved_column)
+ throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER,
+ "Identifier '{}' inside COLUMNS matcher must resolve into a column, but got {}. In scope {}",
+ identifier.getFullName(),
+ resolve_result.resolved_identifier->getNodeTypeName(),
+ scope.scope_node->formatASTForErrorMessage());
+ result.emplace_back(resolve_result.resolved_identifier, resolved_column->getColumnName());
+ }
+ return result;
+ }
+
+ result.resize(matcher_node_typed.getColumnsIdentifiers().size());
+
for (auto & table_expression : table_expressions_stack)
{
bool table_expression_in_resolve_process = nearest_query_scope->table_expressions_in_resolve_process.contains(table_expression.get());
@@ -4784,8 +4872,6 @@ QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::resolveUnqualifiedMatcher(
table_expressions_column_nodes_with_names_stack.push_back(std::move(matched_column_nodes_with_names));
}
- QueryTreeNodesWithNames result;
-
for (auto & table_expression_column_nodes_with_names : table_expressions_column_nodes_with_names_stack)
{
for (auto && table_expression_column_node_with_name : table_expression_column_nodes_with_names)
@@ -5236,7 +5322,7 @@ ProjectionNames QueryAnalyzer::resolveLambda(const QueryTreeNodePtr & lambda_nod
scope.scope_node->formatASTForErrorMessage());
/// Initialize aliases in lambda scope
- QueryExpressionsAliasVisitor visitor(scope);
+ QueryExpressionsAliasVisitor visitor(scope.aliases);
visitor.visit(lambda_to_resolve.getExpression());
/** Replace lambda arguments with new arguments.
@@ -5256,8 +5342,8 @@ ProjectionNames QueryAnalyzer::resolveLambda(const QueryTreeNodePtr & lambda_nod
const auto & lambda_argument_name = lambda_argument_identifier ? lambda_argument_identifier->getIdentifier().getFullName()
: lambda_argument_column->getColumnName();
- bool has_expression_node = scope.alias_name_to_expression_node->contains(lambda_argument_name);
- bool has_alias_node = scope.alias_name_to_lambda_node.contains(lambda_argument_name);
+ bool has_expression_node = scope.aliases.alias_name_to_expression_node->contains(lambda_argument_name);
+ bool has_alias_node = scope.aliases.alias_name_to_lambda_node.contains(lambda_argument_name);
if (has_expression_node || has_alias_node)
{
@@ -5933,7 +6019,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
function_names = AggregateFunctionFactory::instance().getAllRegisteredNames();
possible_function_names.insert(possible_function_names.end(), function_names.begin(), function_names.end());
- for (auto & [name, lambda_node] : scope.alias_name_to_lambda_node)
+ for (auto & [name, lambda_node] : scope.aliases.alias_name_to_lambda_node)
{
if (lambda_node->getNodeType() == QueryTreeNodeType::LAMBDA)
possible_function_names.push_back(name);
@@ -6230,7 +6316,7 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
*
* 4. If node has alias, update its value in scope alias map. Deregister alias from expression_aliases_in_resolve_process.
*/
-ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, IdentifierResolveScope & scope, bool allow_lambda_expression, bool allow_table_expression)
+ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, IdentifierResolveScope & scope, bool allow_lambda_expression, bool allow_table_expression, bool ignore_alias)
{
checkStackSize();
@@ -6267,7 +6353,7 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
result_projection_names.push_back(node_alias);
}
- bool is_duplicated_alias = scope.nodes_with_duplicated_aliases.contains(node);
+ bool is_duplicated_alias = scope.aliases.nodes_with_duplicated_aliases.contains(node);
if (is_duplicated_alias)
scope.non_cached_identifier_lookups_during_expression_resolve.insert({Identifier{node_alias}, IdentifierLookupContext::EXPRESSION});
@@ -6280,7 +6366,7 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
* To support both (SELECT 1) AS expression in projection and (SELECT 1) as subquery in IN, do not use
* alias table because in alias table subquery could be evaluated as scalar.
*/
- bool use_alias_table = true;
+ bool use_alias_table = !ignore_alias;
if (is_duplicated_alias || (allow_table_expression && isSubqueryNodeType(node->getNodeType())))
use_alias_table = false;
@@ -6291,14 +6377,14 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
*
* To resolve b we need to resolve a.
*/
- auto it = scope.alias_name_to_expression_node->find(node_alias);
- if (it != scope.alias_name_to_expression_node->end())
+ auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
+ if (it != scope.aliases.alias_name_to_expression_node->end())
node = it->second;
if (allow_lambda_expression)
{
- it = scope.alias_name_to_lambda_node.find(node_alias);
- if (it != scope.alias_name_to_lambda_node.end())
+ it = scope.aliases.alias_name_to_lambda_node.find(node_alias);
+ if (it != scope.aliases.alias_name_to_lambda_node.end())
node = it->second;
}
}
@@ -6324,17 +6410,9 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
result_projection_names.push_back(projection_name_it->second);
}
- if (resolved_identifier_node && !node_alias.empty())
- scope.alias_name_to_lambda_node.erase(node_alias);
-
if (!resolved_identifier_node && allow_lambda_expression)
- {
resolved_identifier_node = tryResolveIdentifier({unresolved_identifier, IdentifierLookupContext::FUNCTION}, scope).resolved_identifier;
- if (resolved_identifier_node && !node_alias.empty())
- scope.alias_name_to_expression_node->erase(node_alias);
- }
-
if (!resolved_identifier_node && allow_table_expression)
{
resolved_identifier_node = tryResolveIdentifier({unresolved_identifier, IdentifierLookupContext::TABLE_EXPRESSION}, scope).resolved_identifier;
@@ -6573,14 +6651,14 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
*/
if (!node_alias.empty() && use_alias_table && !scope.group_by_use_nulls)
{
- auto it = scope.alias_name_to_expression_node->find(node_alias);
- if (it != scope.alias_name_to_expression_node->end())
+ auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
+ if (it != scope.aliases.alias_name_to_expression_node->end())
it->second = node;
if (allow_lambda_expression)
{
- it = scope.alias_name_to_lambda_node.find(node_alias);
- if (it != scope.alias_name_to_lambda_node.end())
+ it = scope.aliases.alias_name_to_lambda_node.find(node_alias);
+ if (it != scope.aliases.alias_name_to_lambda_node.end())
it->second = node;
}
}
@@ -6588,7 +6666,8 @@ ProjectionNames QueryAnalyzer::resolveExpressionNode(QueryTreeNodePtr & node, Id
if (is_duplicated_alias)
scope.non_cached_identifier_lookups_during_expression_resolve.erase({Identifier{node_alias}, IdentifierLookupContext::EXPRESSION});
- resolved_expressions.emplace(node, result_projection_names);
+ if (!ignore_alias)
+ resolved_expressions.emplace(node, result_projection_names);
scope.popExpressionNode();
bool expression_was_root = scope.expressions_in_resolve_process_stack.empty();
@@ -6953,8 +7032,8 @@ void QueryAnalyzer::initializeQueryJoinTreeNode(QueryTreeNodePtr & join_tree_nod
resolved_identifier = resolved_identifier->clone();
/// Update alias name to table expression map
- auto table_expression_it = scope.alias_name_to_table_expression_node.find(from_table_identifier_alias);
- if (table_expression_it != scope.alias_name_to_table_expression_node.end())
+ auto table_expression_it = scope.aliases.alias_name_to_table_expression_node.find(from_table_identifier_alias);
+ if (table_expression_it != scope.aliases.alias_name_to_table_expression_node.end())
table_expression_it->second = resolved_identifier;
auto table_expression_modifiers = from_table_identifier.getTableExpressionModifiers();
@@ -7153,7 +7232,7 @@ void QueryAnalyzer::initializeTableExpressionData(const QueryTreeNodePtr & table
alias_column_resolve_scope.context = scope.context;
/// Initialize aliases in alias column scope
- QueryExpressionsAliasVisitor visitor(alias_column_resolve_scope);
+ QueryExpressionsAliasVisitor visitor(alias_column_resolve_scope.aliases);
visitor.visit(alias_column_to_resolve->getExpression());
resolveExpressionNode(alias_column_resolve_scope.scope_node,
@@ -7523,22 +7602,25 @@ void QueryAnalyzer::resolveArrayJoin(QueryTreeNodePtr & array_join_node, Identif
for (auto & array_join_expression : array_join_nodes)
{
auto array_join_expression_alias = array_join_expression->getAlias();
- if (!array_join_expression_alias.empty() && scope.alias_name_to_expression_node->contains(array_join_expression_alias))
- throw Exception(ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS,
- "ARRAY JOIN expression {} with duplicate alias {}. In scope {}",
- array_join_expression->formatASTForErrorMessage(),
- array_join_expression_alias,
- scope.scope_node->formatASTForErrorMessage());
- /// Add array join expression into scope
- expressions_visitor.visit(array_join_expression);
+ for (const auto & elem : array_join_nodes)
+ {
+ if (elem->hasAlias())
+ scope.aliases.array_join_aliases.insert(elem->getAlias());
+
+ for (auto & child : elem->getChildren())
+ {
+ if (child)
+ expressions_visitor.visit(child);
+ }
+ }
std::string identifier_full_name;
if (auto * identifier_node = array_join_expression->as())
identifier_full_name = identifier_node->getIdentifier().getFullName();
- resolveExpressionNode(array_join_expression, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/);
+ resolveExpressionNode(array_join_expression, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/, true /*ignore_alias*/);
auto process_array_join_expression = [&](QueryTreeNodePtr & expression)
{
@@ -7605,27 +7687,7 @@ void QueryAnalyzer::resolveArrayJoin(QueryTreeNodePtr & array_join_node, Identif
}
}
- /** Allow to resolve ARRAY JOIN columns from aliases with types after ARRAY JOIN only after ARRAY JOIN expression list is resolved, because
- * during resolution of ARRAY JOIN expression list we must use column type before ARRAY JOIN.
- *
- * Example: SELECT id, value_element FROM test_table ARRAY JOIN [[1,2,3]] AS value_element, value_element AS value
- * It is expected that `value_element AS value` expression inside ARRAY JOIN expression list will be
- * resolved as `value_element` expression with type before ARRAY JOIN.
- * And it is expected that `value_element` inside projection expression list will be resolved as `value_element` expression
- * with type after ARRAY JOIN.
- */
array_join_nodes = std::move(array_join_column_expressions);
- for (auto & array_join_column_expression : array_join_nodes)
- {
- auto it = scope.alias_name_to_expression_node->find(array_join_column_expression->getAlias());
- if (it != scope.alias_name_to_expression_node->end())
- {
- auto & array_join_column_expression_typed = array_join_column_expression->as();
- auto array_join_column = std::make_shared(array_join_column_expression_typed.getColumn(),
- array_join_column_expression_typed.getColumnSource());
- it->second = std::move(array_join_column);
- }
- }
}
void QueryAnalyzer::checkDuplicateTableNamesOrAlias(const QueryTreeNodePtr & join_node, QueryTreeNodePtr & left_table_expr, QueryTreeNodePtr & right_table_expr, IdentifierResolveScope & scope)
@@ -7915,7 +7977,7 @@ void QueryAnalyzer::resolveQueryJoinTreeNode(QueryTreeNodePtr & join_tree_node,
if (alias_name.empty())
return;
- auto [it, inserted] = scope.alias_name_to_table_expression_node.emplace(alias_name, table_expression_node);
+ auto [it, inserted] = scope.aliases.alias_name_to_table_expression_node.emplace(alias_name, table_expression_node);
if (!inserted)
throw Exception(ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS,
"Duplicate aliases {} for table expressions in FROM section are not allowed. Try to register {}. Already registered {}.",
@@ -7984,7 +8046,7 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "WITH TOTALS and WITH ROLLUP or CUBE are not supported together in presence of QUALIFY");
/// Initialize aliases in query node scope
- QueryExpressionsAliasVisitor visitor(scope);
+ QueryExpressionsAliasVisitor visitor(scope.aliases);
if (query_node_typed.hasWith())
visitor.visit(query_node_typed.getWithNode());
@@ -8102,7 +8164,7 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
table_expressions_visitor.visit(query_node_typed.getJoinTree());
initializeQueryJoinTreeNode(query_node_typed.getJoinTree(), scope);
- scope.alias_name_to_table_expression_node.clear();
+ scope.aliases.alias_name_to_table_expression_node.clear();
resolveQueryJoinTreeNode(query_node_typed.getJoinTree(), scope, visitor);
}
@@ -8152,10 +8214,10 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
/// Clone is needed cause aliases share subtrees.
/// If not clone, the same (shared) subtree could be resolved again with different (Nullable) type
/// See 03023_group_by_use_nulls_analyzer_crashes
- for (auto & [key, node] : scope.alias_name_to_expression_node_before_group_by)
- scope.alias_name_to_expression_node_after_group_by[key] = node->clone();
+ for (auto & [key, node] : scope.aliases.alias_name_to_expression_node_before_group_by)
+ scope.aliases.alias_name_to_expression_node_after_group_by[key] = node->clone();
- scope.alias_name_to_expression_node = &scope.alias_name_to_expression_node_after_group_by;
+ scope.aliases.alias_name_to_expression_node = &scope.aliases.alias_name_to_expression_node_after_group_by;
}
if (query_node_typed.hasHaving())
@@ -8227,7 +8289,7 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
* After scope nodes are resolved, we can compare node with duplicate alias with
* node from scope alias table.
*/
- for (const auto & node_with_duplicated_alias : scope.cloned_nodes_with_duplicated_aliases)
+ for (const auto & node_with_duplicated_alias : scope.aliases.cloned_nodes_with_duplicated_aliases)
{
auto node = node_with_duplicated_alias;
auto node_alias = node->getAlias();
@@ -8238,8 +8300,8 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
bool has_node_in_alias_table = false;
- auto it = scope.alias_name_to_expression_node->find(node_alias);
- if (it != scope.alias_name_to_expression_node->end())
+ auto it = scope.aliases.alias_name_to_expression_node->find(node_alias);
+ if (it != scope.aliases.alias_name_to_expression_node->end())
{
has_node_in_alias_table = true;
@@ -8252,8 +8314,8 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
scope.scope_node->formatASTForErrorMessage());
}
- it = scope.alias_name_to_lambda_node.find(node_alias);
- if (it != scope.alias_name_to_lambda_node.end())
+ it = scope.aliases.alias_name_to_lambda_node.find(node_alias);
+ if (it != scope.aliases.alias_name_to_lambda_node.end())
{
has_node_in_alias_table = true;
@@ -8298,10 +8360,10 @@ void QueryAnalyzer::resolveQuery(const QueryTreeNodePtr & query_node, Identifier
/// Remove aliases from expression and lambda nodes
- for (auto & [_, node] : *scope.alias_name_to_expression_node)
+ for (auto & [_, node] : *scope.aliases.alias_name_to_expression_node)
node->removeAlias();
- for (auto & [_, node] : scope.alias_name_to_lambda_node)
+ for (auto & [_, node] : scope.aliases.alias_name_to_lambda_node)
node->removeAlias();
query_node_typed.resolveProjectionColumns(std::move(projection_columns));
diff --git a/src/Analyzer/Passes/RewriteAggregateFunctionWithIfPass.cpp b/src/Analyzer/Passes/RewriteAggregateFunctionWithIfPass.cpp
index 513dd0054d6..a82ad3dced1 100644
--- a/src/Analyzer/Passes/RewriteAggregateFunctionWithIfPass.cpp
+++ b/src/Analyzer/Passes/RewriteAggregateFunctionWithIfPass.cpp
@@ -108,7 +108,7 @@ public:
}
private:
- static inline void resolveAsAggregateFunctionWithIf(FunctionNode & function_node, const DataTypes & argument_types)
+ static void resolveAsAggregateFunctionWithIf(FunctionNode & function_node, const DataTypes & argument_types)
{
auto result_type = function_node.getResultType();
diff --git a/src/Analyzer/Passes/RewriteSumFunctionWithSumAndCountPass.cpp b/src/Analyzer/Passes/RewriteSumFunctionWithSumAndCountPass.cpp
index 917256bf4b1..5646d26f7f6 100644
--- a/src/Analyzer/Passes/RewriteSumFunctionWithSumAndCountPass.cpp
+++ b/src/Analyzer/Passes/RewriteSumFunctionWithSumAndCountPass.cpp
@@ -110,7 +110,7 @@ private:
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
}
- static inline void resolveAsAggregateFunctionNode(FunctionNode & function_node, const DataTypePtr & argument_type)
+ static void resolveAsAggregateFunctionNode(FunctionNode & function_node, const DataTypePtr & argument_type)
{
AggregateFunctionProperties properties;
const auto aggregate_function = AggregateFunctionFactory::instance().get(function_node.getFunctionName(),
diff --git a/src/Analyzer/Passes/SumIfToCountIfPass.cpp b/src/Analyzer/Passes/SumIfToCountIfPass.cpp
index 1a4712aa697..852cbe75c4a 100644
--- a/src/Analyzer/Passes/SumIfToCountIfPass.cpp
+++ b/src/Analyzer/Passes/SumIfToCountIfPass.cpp
@@ -156,7 +156,7 @@ public:
}
private:
- static inline void resolveAsCountIfAggregateFunction(FunctionNode & function_node, const DataTypePtr & argument_type)
+ static void resolveAsCountIfAggregateFunction(FunctionNode & function_node, const DataTypePtr & argument_type)
{
AggregateFunctionProperties properties;
auto aggregate_function = AggregateFunctionFactory::instance().get(
@@ -165,7 +165,7 @@ private:
function_node.resolveAsAggregateFunction(std::move(aggregate_function));
}
- inline QueryTreeNodePtr getMultiplyFunction(QueryTreeNodePtr left, QueryTreeNodePtr right)
+ QueryTreeNodePtr getMultiplyFunction(QueryTreeNodePtr left, QueryTreeNodePtr right)
{
auto multiply_function_node = std::make_shared("multiply");
auto & multiply_arguments_nodes = multiply_function_node->getArguments().getNodes();
diff --git a/src/Analyzer/ValidationUtils.cpp b/src/Analyzer/ValidationUtils.cpp
index b7f9307e4b3..c142a0c7cc0 100644
--- a/src/Analyzer/ValidationUtils.cpp
+++ b/src/Analyzer/ValidationUtils.cpp
@@ -331,6 +331,9 @@ void validateAggregates(const QueryTreeNodePtr & query_node, AggregatesValidatio
if (query_node_typed.hasOrderBy())
validate_group_by_columns_visitor.visit(query_node_typed.getOrderByNode());
+ if (query_node_typed.hasInterpolate())
+ validate_group_by_columns_visitor.visit(query_node_typed.getInterpolate());
+
validate_group_by_columns_visitor.visit(query_node_typed.getProjectionNode());
}
diff --git a/src/Backups/BackupIO_AzureBlobStorage.cpp b/src/Backups/BackupIO_AzureBlobStorage.cpp
index 331cace67d7..8c3c5327e94 100644
--- a/src/Backups/BackupIO_AzureBlobStorage.cpp
+++ b/src/Backups/BackupIO_AzureBlobStorage.cpp
@@ -6,7 +6,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -30,7 +29,7 @@ namespace ErrorCodes
}
BackupReaderAzureBlobStorage::BackupReaderAzureBlobStorage(
- StorageAzureBlob::Configuration configuration_,
+ const StorageAzureConfiguration & configuration_,
bool allow_azure_native_copy,
const ReadSettings & read_settings_,
const WriteSettings & write_settings_,
@@ -39,15 +38,14 @@ BackupReaderAzureBlobStorage::BackupReaderAzureBlobStorage(
, data_source_description{DataSourceType::ObjectStorage, ObjectStorageType::Azure, MetadataStorageType::None, configuration_.getConnectionURL().toString(), false, false}
, configuration(configuration_)
{
- auto client_ptr = StorageAzureBlob::createClient(configuration, /* is_read_only */ false);
+ auto client_ptr = configuration.createClient(/* is_readonly */false, /* attempt_to_create_container */true);
client_ptr->SetClickhouseOptions(Azure::Storage::Blobs::ClickhouseClientOptions{.IsClientForDisk=true});
- object_storage = std::make_unique(
- "BackupReaderAzureBlobStorage",
- std::move(client_ptr),
- StorageAzureBlob::createSettings(context_),
- configuration.container,
- configuration.getConnectionURL().toString());
+ object_storage = std::make_unique("BackupReaderAzureBlobStorage",
+ std::move(client_ptr),
+ configuration.createSettings(context_),
+ configuration_.container,
+ configuration.getConnectionURL().toString());
client = object_storage->getAzureBlobStorageClient();
auto settings_copy = *object_storage->getSettings();
@@ -121,7 +119,7 @@ void BackupReaderAzureBlobStorage::copyFileToDisk(const String & path_in_backup,
BackupWriterAzureBlobStorage::BackupWriterAzureBlobStorage(
- StorageAzureBlob::Configuration configuration_,
+ const StorageAzureConfiguration & configuration_,
bool allow_azure_native_copy,
const ReadSettings & read_settings_,
const WriteSettings & write_settings_,
@@ -131,13 +129,13 @@ BackupWriterAzureBlobStorage::BackupWriterAzureBlobStorage(
, data_source_description{DataSourceType::ObjectStorage, ObjectStorageType::Azure, MetadataStorageType::None, configuration_.getConnectionURL().toString(), false, false}
, configuration(configuration_)
{
- auto client_ptr = StorageAzureBlob::createClient(configuration, /* is_read_only */ false, attempt_to_create_container);
+ auto client_ptr = configuration.createClient(/* is_readonly */false, attempt_to_create_container);
client_ptr->SetClickhouseOptions(Azure::Storage::Blobs::ClickhouseClientOptions{.IsClientForDisk=true});
object_storage = std::make_unique("BackupWriterAzureBlobStorage",
std::move(client_ptr),
- StorageAzureBlob::createSettings(context_),
- configuration_.container,
+ configuration.createSettings(context_),
+ configuration.container,
configuration_.getConnectionURL().toString());
client = object_storage->getAzureBlobStorageClient();
auto settings_copy = *object_storage->getSettings();
@@ -145,8 +143,13 @@ BackupWriterAzureBlobStorage::BackupWriterAzureBlobStorage(
settings = std::make_unique(settings_copy);
}
-void BackupWriterAzureBlobStorage::copyFileFromDisk(const String & path_in_backup, DiskPtr src_disk, const String & src_path,
- bool copy_encrypted, UInt64 start_pos, UInt64 length)
+void BackupWriterAzureBlobStorage::copyFileFromDisk(
+ const String & path_in_backup,
+ DiskPtr src_disk,
+ const String & src_path,
+ bool copy_encrypted,
+ UInt64 start_pos,
+ UInt64 length)
{
/// Use the native copy as a more optimal way to copy a file from AzureBlobStorage to AzureBlobStorage if it's possible.
auto source_data_source_description = src_disk->getDataSourceDescription();
@@ -196,10 +199,16 @@ void BackupWriterAzureBlobStorage::copyFile(const String & destination, const St
threadPoolCallbackRunnerUnsafe(getBackupsIOThreadPool().get(), "BackupWRAzure"));
}
-void BackupWriterAzureBlobStorage::copyDataToFile(const String & path_in_backup, const CreateReadBufferFunction & create_read_buffer, UInt64 start_pos, UInt64 length)
+void BackupWriterAzureBlobStorage::copyDataToFile(
+ const String & path_in_backup,
+ const CreateReadBufferFunction & create_read_buffer,
+ UInt64 start_pos,
+ UInt64 length)
{
- copyDataToAzureBlobStorageFile(create_read_buffer, start_pos, length, client, configuration.container, fs::path(configuration.blob_path) / path_in_backup, settings,
- threadPoolCallbackRunnerUnsafe(getBackupsIOThreadPool().get(), "BackupWRAzure"));
+ copyDataToAzureBlobStorageFile(
+ create_read_buffer, start_pos, length, client, configuration.container,
+ fs::path(configuration.blob_path) / path_in_backup, settings,
+ threadPoolCallbackRunnerUnsafe(getBackupsIOThreadPool().get(), "BackupWRAzure"));
}
BackupWriterAzureBlobStorage::~BackupWriterAzureBlobStorage() = default;
@@ -217,7 +226,7 @@ UInt64 BackupWriterAzureBlobStorage::getFileSize(const String & file_name)
object_storage->listObjects(key,children,/*max_keys*/0);
if (children.empty())
throw Exception(ErrorCodes::AZURE_BLOB_STORAGE_ERROR, "Object must exist");
- return children[0].metadata.size_bytes;
+ return children[0]->metadata->size_bytes;
}
std::unique_ptr BackupWriterAzureBlobStorage::readFile(const String & file_name, size_t /*expected_file_size*/)
diff --git a/src/Backups/BackupIO_AzureBlobStorage.h b/src/Backups/BackupIO_AzureBlobStorage.h
index 3a909ab684a..61688107839 100644
--- a/src/Backups/BackupIO_AzureBlobStorage.h
+++ b/src/Backups/BackupIO_AzureBlobStorage.h
@@ -5,8 +5,8 @@
#if USE_AZURE_BLOB_STORAGE
#include
#include
-#include
#include
+#include
namespace DB
@@ -17,24 +17,30 @@ class BackupReaderAzureBlobStorage : public BackupReaderDefault
{
public:
BackupReaderAzureBlobStorage(
- StorageAzureBlob::Configuration configuration_,
+ const StorageAzureConfiguration & configuration_,
bool allow_azure_native_copy,
const ReadSettings & read_settings_,
const WriteSettings & write_settings_,
const ContextPtr & context_);
+
~BackupReaderAzureBlobStorage() override;
bool fileExists(const String & file_name) override;
UInt64 getFileSize(const String & file_name) override;
std::unique_ptr readFile(const String & file_name) override;
- void copyFileToDisk(const String & path_in_backup, size_t file_size, bool encrypted_in_backup,
- DiskPtr destination_disk, const String & destination_path, WriteMode write_mode) override;
+ void copyFileToDisk(
+ const String & path_in_backup,
+ size_t file_size,
+ bool encrypted_in_backup,
+ DiskPtr destination_disk,
+ const String & destination_path,
+ WriteMode write_mode) override;
private:
const DataSourceDescription data_source_description;
std::shared_ptr client;
- StorageAzureBlob::Configuration configuration;
+ StorageAzureConfiguration configuration;
std::unique_ptr object_storage;
std::shared_ptr settings;
};
@@ -43,21 +49,32 @@ class BackupWriterAzureBlobStorage : public BackupWriterDefault
{
public:
BackupWriterAzureBlobStorage(
- StorageAzureBlob::Configuration configuration_,
+ const StorageAzureConfiguration & configuration_,
bool allow_azure_native_copy,
const ReadSettings & read_settings_,
const WriteSettings & write_settings_,
const ContextPtr & context_,
bool attempt_to_create_container);
+
~BackupWriterAzureBlobStorage() override;
bool fileExists(const String & file_name) override;
UInt64 getFileSize(const String & file_name) override;
std::unique_ptr writeFile(const String & file_name) override;
- void copyDataToFile(const String & path_in_backup, const CreateReadBufferFunction & create_read_buffer, UInt64 start_pos, UInt64 length) override;
- void copyFileFromDisk(const String & path_in_backup, DiskPtr src_disk, const String & src_path,
- bool copy_encrypted, UInt64 start_pos, UInt64 length) override;
+ void copyDataToFile(
+ const String & path_in_backup,
+ const CreateReadBufferFunction & create_read_buffer,
+ UInt64 start_pos,
+ UInt64 length) override;
+
+ void copyFileFromDisk(
+ const String & path_in_backup,
+ DiskPtr src_disk,
+ const String & src_path,
+ bool copy_encrypted,
+ UInt64 start_pos,
+ UInt64 length) override;
void copyFile(const String & destination, const String & source, size_t size) override;
@@ -67,9 +84,10 @@ public:
private:
std::unique_ptr readFile(const String & file_name, size_t expected_file_size) override;
void removeFilesBatch(const Strings & file_names);
+
const DataSourceDescription data_source_description;
std::shared_ptr client;
- StorageAzureBlob::Configuration configuration;
+ StorageAzureConfiguration configuration;
std::unique_ptr object_storage;
std::shared_ptr settings;
};
diff --git a/src/Backups/BackupIO_S3.cpp b/src/Backups/BackupIO_S3.cpp
index 15860363615..92f086295a0 100644
--- a/src/Backups/BackupIO_S3.cpp
+++ b/src/Backups/BackupIO_S3.cpp
@@ -131,10 +131,10 @@ BackupReaderS3::BackupReaderS3(
: BackupReaderDefault(read_settings_, write_settings_, getLogger("BackupReaderS3"))
, s3_uri(s3_uri_)
, data_source_description{DataSourceType::ObjectStorage, ObjectStorageType::S3, MetadataStorageType::None, s3_uri.endpoint, false, false}
- , s3_settings(context_->getStorageS3Settings().getSettings(s3_uri.uri.toString(), context_->getUserName(), /*ignore_user=*/is_internal_backup))
+ , s3_settings(context_->getStorageS3Settings().getSettings(s3_uri.uri.toString(), context_->getUserName(), /*ignore_user=*/is_internal_backup).value_or(S3Settings{}))
{
auto & request_settings = s3_settings.request_settings;
- request_settings.updateFromSettings(context_->getSettingsRef());
+ request_settings.updateFromSettingsIfChanged(context_->getSettingsRef());
request_settings.max_single_read_retries = context_->getSettingsRef().s3_max_single_read_retries; // FIXME: Avoid taking value for endpoint
request_settings.allow_native_copy = allow_s3_native_copy;
client = makeS3Client(s3_uri_, access_key_id_, secret_access_key_, s3_settings, context_);
@@ -188,6 +188,7 @@ void BackupReaderS3::copyFileToDisk(const String & path_in_backup, size_t file_s
fs::path(s3_uri.key) / path_in_backup,
0,
file_size,
+ /* dest_s3_client= */ destination_disk->getS3StorageClient(),
/* dest_bucket= */ blob_path[1],
/* dest_key= */ blob_path[0],
s3_settings.request_settings,
@@ -222,10 +223,10 @@ BackupWriterS3::BackupWriterS3(
: BackupWriterDefault(read_settings_, write_settings_, getLogger("BackupWriterS3"))
, s3_uri(s3_uri_)
, data_source_description{DataSourceType::ObjectStorage, ObjectStorageType::S3, MetadataStorageType::None, s3_uri.endpoint, false, false}
- , s3_settings(context_->getStorageS3Settings().getSettings(s3_uri.uri.toString(), context_->getUserName(), /*ignore_user=*/is_internal_backup))
+ , s3_settings(context_->getStorageS3Settings().getSettings(s3_uri.uri.toString(), context_->getUserName(), /*ignore_user=*/is_internal_backup).value_or(S3Settings{}))
{
auto & request_settings = s3_settings.request_settings;
- request_settings.updateFromSettings(context_->getSettingsRef());
+ request_settings.updateFromSettingsIfChanged(context_->getSettingsRef());
request_settings.max_single_read_retries = context_->getSettingsRef().s3_max_single_read_retries; // FIXME: Avoid taking value for endpoint
request_settings.allow_native_copy = allow_s3_native_copy;
request_settings.setStorageClassName(storage_class_name);
@@ -252,18 +253,20 @@ void BackupWriterS3::copyFileFromDisk(const String & path_in_backup, DiskPtr src
{
LOG_TRACE(log, "Copying file {} from disk {} to S3", src_path, src_disk->getName());
copyS3File(
- client,
+ src_disk->getS3StorageClient(),
/* src_bucket */ blob_path[1],
/* src_key= */ blob_path[0],
start_pos,
length,
- s3_uri.bucket,
- fs::path(s3_uri.key) / path_in_backup,
+ /* dest_s3_client= */ client,
+ /* dest_bucket= */ s3_uri.bucket,
+ /* dest_key= */ fs::path(s3_uri.key) / path_in_backup,
s3_settings.request_settings,
read_settings,
blob_storage_log,
{},
- threadPoolCallbackRunnerUnsafe(getBackupsIOThreadPool().get(), "BackupWriterS3"));
+ threadPoolCallbackRunnerUnsafe(getBackupsIOThreadPool().get(), "BackupWriterS3"),
+ /*for_disk_s3=*/false);
return; /// copied!
}
}
@@ -281,8 +284,9 @@ void BackupWriterS3::copyFile(const String & destination, const String & source,
/* src_key= */ fs::path(s3_uri.key) / source,
0,
size,
- s3_uri.bucket,
- fs::path(s3_uri.key) / destination,
+ /* dest_s3_client= */ client,
+ /* dest_bucket= */ s3_uri.bucket,
+ /* dest_key= */ fs::path(s3_uri.key) / destination,
s3_settings.request_settings,
read_settings,
blob_storage_log,
diff --git a/src/Backups/registerBackupEngineAzureBlobStorage.cpp b/src/Backups/registerBackupEngineAzureBlobStorage.cpp
index 8b05965f472..81e3c104da1 100644
--- a/src/Backups/registerBackupEngineAzureBlobStorage.cpp
+++ b/src/Backups/registerBackupEngineAzureBlobStorage.cpp
@@ -5,11 +5,11 @@
#if USE_AZURE_BLOB_STORAGE
#include
-#include
#include
#include
#include
#include
+#include
#include
#endif
@@ -49,7 +49,7 @@ void registerBackupEngineAzureBlobStorage(BackupFactory & factory)
const String & id_arg = params.backup_info.id_arg;
const auto & args = params.backup_info.args;
- StorageAzureBlob::Configuration configuration;
+ StorageAzureConfiguration configuration;
if (!id_arg.empty())
{
@@ -81,10 +81,11 @@ void registerBackupEngineAzureBlobStorage(BackupFactory & factory)
}
if (args.size() > 1)
- throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Backup AzureBlobStorage requires 1 or 2 arguments: named_collection, [filename]");
+ throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
+ "Backup AzureBlobStorage requires 1 or 2 arguments: named_collection, [filename]");
if (args.size() == 1)
- configuration.blob_path = args[0].safeGet();
+ configuration.setPath(args[0].safeGet());
}
else
@@ -116,12 +117,16 @@ void registerBackupEngineAzureBlobStorage(BackupFactory & factory)
}
BackupImpl::ArchiveParams archive_params;
- if (hasRegisteredArchiveFileExtension(configuration.blob_path))
+ if (hasRegisteredArchiveFileExtension(configuration.getPath()))
{
if (params.is_internal_backup)
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Using archives with backups on clusters is disabled");
- archive_params.archive_name = removeFileNameFromURL(configuration.blob_path);
+ auto path = configuration.getPath();
+ auto filename = removeFileNameFromURL(path);
+ configuration.setPath(path);
+
+ archive_params.archive_name = filename;
archive_params.compression_method = params.compression_method;
archive_params.compression_level = params.compression_level;
archive_params.password = params.password;
diff --git a/src/BridgeHelper/CatBoostLibraryBridgeHelper.h b/src/BridgeHelper/CatBoostLibraryBridgeHelper.h
index 55dfd715f00..5d5c6d01705 100644
--- a/src/BridgeHelper/CatBoostLibraryBridgeHelper.h
+++ b/src/BridgeHelper/CatBoostLibraryBridgeHelper.h
@@ -14,8 +14,8 @@ namespace DB
class CatBoostLibraryBridgeHelper final : public LibraryBridgeHelper
{
public:
- static constexpr inline auto PING_HANDLER = "/catboost_ping";
- static constexpr inline auto MAIN_HANDLER = "/catboost_request";
+ static constexpr auto PING_HANDLER = "/catboost_ping";
+ static constexpr auto MAIN_HANDLER = "/catboost_request";
explicit CatBoostLibraryBridgeHelper(
ContextPtr context_,
@@ -38,11 +38,11 @@ protected:
bool bridgeHandShake() override;
private:
- static constexpr inline auto CATBOOST_LIST_METHOD = "catboost_list";
- static constexpr inline auto CATBOOST_REMOVEMODEL_METHOD = "catboost_removeModel";
- static constexpr inline auto CATBOOST_REMOVEALLMODELS_METHOD = "catboost_removeAllModels";
- static constexpr inline auto CATBOOST_GETTREECOUNT_METHOD = "catboost_GetTreeCount";
- static constexpr inline auto CATBOOST_LIB_EVALUATE_METHOD = "catboost_libEvaluate";
+ static constexpr auto CATBOOST_LIST_METHOD = "catboost_list";
+ static constexpr auto CATBOOST_REMOVEMODEL_METHOD = "catboost_removeModel";
+ static constexpr auto CATBOOST_REMOVEALLMODELS_METHOD = "catboost_removeAllModels";
+ static constexpr auto CATBOOST_GETTREECOUNT_METHOD = "catboost_GetTreeCount";
+ static constexpr auto CATBOOST_LIB_EVALUATE_METHOD = "catboost_libEvaluate";
Poco::URI createRequestURI(const String & method) const;
diff --git a/src/BridgeHelper/ExternalDictionaryLibraryBridgeHelper.h b/src/BridgeHelper/ExternalDictionaryLibraryBridgeHelper.h
index 5632fd2a28e..63816aa63ef 100644
--- a/src/BridgeHelper/ExternalDictionaryLibraryBridgeHelper.h
+++ b/src/BridgeHelper/ExternalDictionaryLibraryBridgeHelper.h
@@ -25,8 +25,8 @@ public:
String dict_attributes;
};
- static constexpr inline auto PING_HANDLER = "/extdict_ping";
- static constexpr inline auto MAIN_HANDLER = "/extdict_request";
+ static constexpr auto PING_HANDLER = "/extdict_ping";
+ static constexpr auto MAIN_HANDLER = "/extdict_request";
ExternalDictionaryLibraryBridgeHelper(ContextPtr context_, const Block & sample_block, const Field & dictionary_id_, const LibraryInitData & library_data_);
@@ -62,14 +62,14 @@ protected:
ReadWriteBufferFromHTTP::OutStreamCallback getInitLibraryCallback() const;
private:
- static constexpr inline auto EXT_DICT_LIB_NEW_METHOD = "extDict_libNew";
- static constexpr inline auto EXT_DICT_LIB_CLONE_METHOD = "extDict_libClone";
- static constexpr inline auto EXT_DICT_LIB_DELETE_METHOD = "extDict_libDelete";
- static constexpr inline auto EXT_DICT_LOAD_ALL_METHOD = "extDict_loadAll";
- static constexpr inline auto EXT_DICT_LOAD_IDS_METHOD = "extDict_loadIds";
- static constexpr inline auto EXT_DICT_LOAD_KEYS_METHOD = "extDict_loadKeys";
- static constexpr inline auto EXT_DICT_IS_MODIFIED_METHOD = "extDict_isModified";
- static constexpr inline auto EXT_DICT_SUPPORTS_SELECTIVE_LOAD_METHOD = "extDict_supportsSelectiveLoad";
+ static constexpr auto EXT_DICT_LIB_NEW_METHOD = "extDict_libNew";
+ static constexpr auto EXT_DICT_LIB_CLONE_METHOD = "extDict_libClone";
+ static constexpr auto EXT_DICT_LIB_DELETE_METHOD = "extDict_libDelete";
+ static constexpr auto EXT_DICT_LOAD_ALL_METHOD = "extDict_loadAll";
+ static constexpr auto EXT_DICT_LOAD_IDS_METHOD = "extDict_loadIds";
+ static constexpr auto EXT_DICT_LOAD_KEYS_METHOD = "extDict_loadKeys";
+ static constexpr auto EXT_DICT_IS_MODIFIED_METHOD = "extDict_isModified";
+ static constexpr auto EXT_DICT_SUPPORTS_SELECTIVE_LOAD_METHOD = "extDict_supportsSelectiveLoad";
Poco::URI createRequestURI(const String & method) const;
diff --git a/src/BridgeHelper/IBridgeHelper.h b/src/BridgeHelper/IBridgeHelper.h
index 6812bd04a03..8ce1c0e143a 100644
--- a/src/BridgeHelper/IBridgeHelper.h
+++ b/src/BridgeHelper/IBridgeHelper.h
@@ -16,9 +16,9 @@ class IBridgeHelper: protected WithContext
{
public:
- static constexpr inline auto DEFAULT_HOST = "127.0.0.1";
- static constexpr inline auto DEFAULT_FORMAT = "RowBinary";
- static constexpr inline auto PING_OK_ANSWER = "Ok.";
+ static constexpr auto DEFAULT_HOST = "127.0.0.1";
+ static constexpr auto DEFAULT_FORMAT = "RowBinary";
+ static constexpr auto PING_OK_ANSWER = "Ok.";
static const inline std::string PING_METHOD = Poco::Net::HTTPRequest::HTTP_GET;
static const inline std::string MAIN_METHOD = Poco::Net::HTTPRequest::HTTP_POST;
diff --git a/src/BridgeHelper/LibraryBridgeHelper.h b/src/BridgeHelper/LibraryBridgeHelper.h
index 8940f9d1c9e..0c56fe7a221 100644
--- a/src/BridgeHelper/LibraryBridgeHelper.h
+++ b/src/BridgeHelper/LibraryBridgeHelper.h
@@ -37,7 +37,7 @@ protected:
Poco::URI createBaseURI() const override;
- static constexpr inline size_t DEFAULT_PORT = 9012;
+ static constexpr size_t DEFAULT_PORT = 9012;
const Poco::Util::AbstractConfiguration & config;
LoggerPtr log;
diff --git a/src/BridgeHelper/XDBCBridgeHelper.h b/src/BridgeHelper/XDBCBridgeHelper.h
index b557e12b85b..5f4c7fd8381 100644
--- a/src/BridgeHelper/XDBCBridgeHelper.h
+++ b/src/BridgeHelper/XDBCBridgeHelper.h
@@ -52,12 +52,12 @@ class XDBCBridgeHelper : public IXDBCBridgeHelper
{
public:
- static constexpr inline auto DEFAULT_PORT = BridgeHelperMixin::DEFAULT_PORT;
- static constexpr inline auto PING_HANDLER = "/ping";
- static constexpr inline auto MAIN_HANDLER = "/";
- static constexpr inline auto COL_INFO_HANDLER = "/columns_info";
- static constexpr inline auto IDENTIFIER_QUOTE_HANDLER = "/identifier_quote";
- static constexpr inline auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed";
+ static constexpr auto DEFAULT_PORT = BridgeHelperMixin::DEFAULT_PORT;
+ static constexpr auto PING_HANDLER = "/ping";
+ static constexpr auto MAIN_HANDLER = "/";
+ static constexpr auto COL_INFO_HANDLER = "/columns_info";
+ static constexpr auto IDENTIFIER_QUOTE_HANDLER = "/identifier_quote";
+ static constexpr auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed";
XDBCBridgeHelper(
ContextPtr context_,
@@ -256,7 +256,7 @@ protected:
struct JDBCBridgeMixin
{
- static constexpr inline auto DEFAULT_PORT = 9019;
+ static constexpr auto DEFAULT_PORT = 9019;
static String configPrefix()
{
@@ -287,7 +287,7 @@ struct JDBCBridgeMixin
struct ODBCBridgeMixin
{
- static constexpr inline auto DEFAULT_PORT = 9018;
+ static constexpr auto DEFAULT_PORT = 9018;
static String configPrefix()
{
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4e8946facda..f2e10a27b75 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -115,8 +115,11 @@ if (TARGET ch_contrib::nats_io)
add_headers_and_sources(dbms Storages/NATS)
endif()
-add_headers_and_sources(dbms Storages/DataLakes)
-add_headers_and_sources(dbms Storages/DataLakes/Iceberg)
+add_headers_and_sources(dbms Storages/ObjectStorage)
+add_headers_and_sources(dbms Storages/ObjectStorage/Azure)
+add_headers_and_sources(dbms Storages/ObjectStorage/S3)
+add_headers_and_sources(dbms Storages/ObjectStorage/HDFS)
+add_headers_and_sources(dbms Storages/ObjectStorage/DataLakes)
add_headers_and_sources(dbms Common/NamedCollections)
if (TARGET ch_contrib::amqp_cpp)
@@ -144,7 +147,6 @@ if (TARGET ch_contrib::azure_sdk)
endif()
if (TARGET ch_contrib::hdfs)
- add_headers_and_sources(dbms Storages/HDFS)
add_headers_and_sources(dbms Disks/ObjectStorages/HDFS)
endif()
diff --git a/src/Client/ClientBase.cpp b/src/Client/ClientBase.cpp
index b6f821794f1..f8391c64d5a 100644
--- a/src/Client/ClientBase.cpp
+++ b/src/Client/ClientBase.cpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -643,6 +644,9 @@ try
bool extras_into_stdout = need_render_progress || logs_into_stdout;
bool select_only_into_file = select_into_file && !select_into_file_and_stdout;
+ if (!out_file_buf && default_output_compression_method != CompressionMethod::None)
+ out_file_buf = wrapWriteBufferWithCompressionMethod(out_buf, default_output_compression_method, 3, 0);
+
/// It is not clear how to write progress and logs
/// intermixed with data with parallel formatting.
/// It may increase code complexity significantly.
@@ -735,7 +739,7 @@ bool ClientBase::isRegularFile(int fd)
return fstat(fd, &file_stat) == 0 && S_ISREG(file_stat.st_mode);
}
-void ClientBase::setDefaultFormatsFromConfiguration()
+void ClientBase::setDefaultFormatsAndCompressionFromConfiguration()
{
if (config().has("output-format"))
{
@@ -759,6 +763,10 @@ void ClientBase::setDefaultFormatsFromConfiguration()
default_output_format = *format_from_file_name;
else
default_output_format = "TSV";
+
+ std::optional file_name = tryGetFileNameFromFileDescriptor(STDOUT_FILENO);
+ if (file_name)
+ default_output_compression_method = chooseCompressionMethod(*file_name, "");
}
else if (is_interactive)
{
diff --git a/src/Client/ClientBase.h b/src/Client/ClientBase.h
index 64cbdbe8989..7a0489641c8 100644
--- a/src/Client/ClientBase.h
+++ b/src/Client/ClientBase.h
@@ -190,7 +190,7 @@ protected:
/// Adjust some settings after command line options and config had been processed.
void adjustSettings();
- void setDefaultFormatsFromConfiguration();
+ void setDefaultFormatsAndCompressionFromConfiguration();
void initTTYBuffer(ProgressOption progress);
@@ -224,6 +224,7 @@ protected:
String pager;
String default_output_format; /// Query results output format.
+ CompressionMethod default_output_compression_method = CompressionMethod::None;
String default_input_format; /// Tables' format for clickhouse-local.
bool select_into_file = false; /// If writing result INTO OUTFILE. It affects progress rendering.
diff --git a/src/Columns/ColumnArray.cpp b/src/Columns/ColumnArray.cpp
index 8d5c246c48c..1e94240dd4c 100644
--- a/src/Columns/ColumnArray.cpp
+++ b/src/Columns/ColumnArray.cpp
@@ -1289,4 +1289,14 @@ size_t ColumnArray::getNumberOfDimensions() const
return 1 + nested_array->getNumberOfDimensions(); /// Every modern C++ compiler optimizes tail recursion.
}
+void ColumnArray::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ Columns nested_source_columns;
+ nested_source_columns.reserve(source_columns.size());
+ for (const auto & source_column : source_columns)
+ nested_source_columns.push_back(assert_cast(*source_column).getDataPtr());
+
+ data->takeDynamicStructureFromSourceColumns(nested_source_columns);
+}
+
}
diff --git a/src/Columns/ColumnArray.h b/src/Columns/ColumnArray.h
index 230d8830265..53eb5166df8 100644
--- a/src/Columns/ColumnArray.h
+++ b/src/Columns/ColumnArray.h
@@ -175,6 +175,9 @@ public:
size_t getNumberOfDimensions() const;
+ bool hasDynamicStructure() const override { return getData().hasDynamicStructure(); }
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
+
private:
WrappedPtr data;
WrappedPtr offsets;
diff --git a/src/Columns/ColumnCompressed.h b/src/Columns/ColumnCompressed.h
index 6763410b46d..934adf07cf4 100644
--- a/src/Columns/ColumnCompressed.h
+++ b/src/Columns/ColumnCompressed.h
@@ -122,6 +122,9 @@ public:
UInt64 getNumberOfDefaultRows() const override { throwMustBeDecompressed(); }
void getIndicesOfNonDefaultRows(Offsets &, size_t, size_t) const override { throwMustBeDecompressed(); }
+ bool hasDynamicStructure() const override { throwMustBeDecompressed(); }
+ void takeDynamicStructureFromSourceColumns(const Columns &) override { throwMustBeDecompressed(); }
+
protected:
size_t rows;
size_t bytes;
diff --git a/src/Columns/ColumnConst.h b/src/Columns/ColumnConst.h
index 4a3d40ca0d2..c2c0fa3027c 100644
--- a/src/Columns/ColumnConst.h
+++ b/src/Columns/ColumnConst.h
@@ -306,6 +306,8 @@ public:
T getValue() const { return static_cast(getField().safeGet()); }
bool isCollationSupported() const override { return data->isCollationSupported(); }
+
+ bool hasDynamicStructure() const override { return data->hasDynamicStructure(); }
};
ColumnConst::Ptr createColumnConst(const ColumnPtr & column, Field value);
diff --git a/src/Columns/ColumnDecimal.h b/src/Columns/ColumnDecimal.h
index e0ea26744dc..e606aaaff0f 100644
--- a/src/Columns/ColumnDecimal.h
+++ b/src/Columns/ColumnDecimal.h
@@ -141,6 +141,14 @@ protected:
UInt32 scale;
};
+template
+concept is_col_over_big_decimal = std::is_same_v>
+ && is_decimal && is_over_big_int;
+
+template
+concept is_col_int_decimal = std::is_same_v>
+ && is_decimal && std::is_integral_v;
+
template class ColumnVector;
template struct ColumnVectorOrDecimalT { using Col = ColumnVector; };
template struct ColumnVectorOrDecimalT { using Col = ColumnDecimal; };
diff --git a/src/Columns/ColumnDynamic.cpp b/src/Columns/ColumnDynamic.cpp
new file mode 100644
index 00000000000..3c147b6f123
--- /dev/null
+++ b/src/Columns/ColumnDynamic.cpp
@@ -0,0 +1,758 @@
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace DB
+{
+
+namespace ErrorCodes
+{
+ extern const int LOGICAL_ERROR;
+ extern const int PARAMETER_OUT_OF_BOUND;
+}
+
+
+ColumnDynamic::ColumnDynamic(size_t max_dynamic_types_) : max_dynamic_types(max_dynamic_types_)
+{
+ /// Create empty Variant.
+ variant_info.variant_type = std::make_shared(DataTypes{});
+ variant_info.variant_name = variant_info.variant_type->getName();
+ variant_column = variant_info.variant_type->createColumn();
+}
+
+ColumnDynamic::ColumnDynamic(
+ MutableColumnPtr variant_column_, const VariantInfo & variant_info_, size_t max_dynamic_types_, const Statistics & statistics_)
+ : variant_column(std::move(variant_column_))
+ , variant_info(variant_info_)
+ , max_dynamic_types(max_dynamic_types_)
+ , statistics(statistics_)
+{
+}
+
+ColumnDynamic::MutablePtr ColumnDynamic::create(MutableColumnPtr variant_column, const DataTypePtr & variant_type, size_t max_dynamic_types_, const Statistics & statistics_)
+{
+ VariantInfo variant_info;
+ variant_info.variant_type = variant_type;
+ variant_info.variant_name = variant_type->getName();
+ const auto & variants = assert_cast(*variant_type).getVariants();
+ variant_info.variant_names.reserve(variants.size());
+ variant_info.variant_name_to_discriminator.reserve(variants.size());
+ for (ColumnVariant::Discriminator discr = 0; discr != variants.size(); ++discr)
+ {
+ const auto & variant_name = variant_info.variant_names.emplace_back(variants[discr]->getName());
+ variant_info.variant_name_to_discriminator[variant_name] = discr;
+ }
+
+ return create(std::move(variant_column), variant_info, max_dynamic_types_, statistics_);
+}
+
+bool ColumnDynamic::addNewVariant(const DB::DataTypePtr & new_variant)
+{
+ /// Check if we already have such variant.
+ if (variant_info.variant_name_to_discriminator.contains(new_variant->getName()))
+ return true;
+
+ /// Check if we reached maximum number of variants.
+ if (variant_info.variant_names.size() >= max_dynamic_types)
+ {
+ /// ColumnDynamic can have max_dynamic_types number of variants only when it has String as a variant.
+ /// Otherwise we won't be able to cast new variants to Strings.
+ if (!variant_info.variant_name_to_discriminator.contains("String"))
+ throw Exception(ErrorCodes::LOGICAL_ERROR, "Maximum number of variants reached, but no String variant exists");
+
+ return false;
+ }
+
+ /// If we have (max_dynamic_types - 1) number of variants and don't have String variant, we can add only String variant.
+ if (variant_info.variant_names.size() == max_dynamic_types - 1 && new_variant->getName() != "String" && !variant_info.variant_name_to_discriminator.contains("String"))
+ return false;
+
+ const DataTypes & current_variants = assert_cast(*variant_info.variant_type).getVariants();
+ DataTypes all_variants = current_variants;
+ all_variants.push_back(new_variant);
+ auto new_variant_type = std::make_shared(all_variants);
+ updateVariantInfoAndExpandVariantColumn(new_variant_type);
+ return true;
+}
+
+void ColumnDynamic::addStringVariant()
+{
+ if (!addNewVariant(std::make_shared()))
+ throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot add String variant to Dynamic column, it's a bug");
+}
+
+void ColumnDynamic::updateVariantInfoAndExpandVariantColumn(const DB::DataTypePtr & new_variant_type)
+{
+ const DataTypes & current_variants = assert_cast(variant_info.variant_type.get())->getVariants();
+ const DataTypes & new_variants = assert_cast(new_variant_type.get())->getVariants();
+
+ Names new_variant_names;
+ new_variant_names.reserve(new_variants.size());
+ std::unordered_map new_variant_name_to_discriminator;
+ new_variant_name_to_discriminator.reserve(new_variants.size());
+ std::vector> new_variant_columns_and_discriminators_to_add;
+ new_variant_columns_and_discriminators_to_add.reserve(new_variants.size() - current_variants.size());
+ std::vector current_to_new_discriminators;
+ current_to_new_discriminators.resize(current_variants.size());
+
+ for (ColumnVariant::Discriminator discr = 0; discr != new_variants.size(); ++discr)
+ {
+ const auto & name = new_variant_names.emplace_back(new_variants[discr]->getName());
+ new_variant_name_to_discriminator[name] = discr;
+
+ auto current_it = variant_info.variant_name_to_discriminator.find(name);
+ if (current_it == variant_info.variant_name_to_discriminator.end())
+ new_variant_columns_and_discriminators_to_add.emplace_back(new_variants[discr]->createColumn(), discr);
+ else
+ current_to_new_discriminators[current_it->second] = discr;
+ }
+
+ variant_info.variant_type = new_variant_type;
+ variant_info.variant_name = new_variant_type->getName();
+ variant_info.variant_names = new_variant_names;
+ variant_info.variant_name_to_discriminator = new_variant_name_to_discriminator;
+ assert_cast(*variant_column).extend(current_to_new_discriminators, std::move(new_variant_columns_and_discriminators_to_add));
+ /// Clear mappings cache because now with new Variant we will have new mappings.
+ variant_mappings_cache.clear();
+}
+
+std::vector * ColumnDynamic::combineVariants(const DB::ColumnDynamic::VariantInfo & other_variant_info)
+{
+ /// Check if we already have global discriminators mapping for other Variant in cache.
+ /// It's used to not calculate the same mapping each call of insertFrom with the same columns.
+ auto cache_it = variant_mappings_cache.find(other_variant_info.variant_name);
+ if (cache_it != variant_mappings_cache.end())
+ return &cache_it->second;
+
+ /// Check if we already tried to combine these variants but failed due to max_dynamic_types limit.
+ if (variants_with_failed_combination.contains(other_variant_info.variant_name))
+ return nullptr;
+
+ const DataTypes & other_variants = assert_cast(*other_variant_info.variant_type).getVariants();
+
+ size_t num_new_variants = 0;
+ for (size_t i = 0; i != other_variants.size(); ++i)
+ {
+ if (!variant_info.variant_name_to_discriminator.contains(other_variant_info.variant_names[i]))
+ ++num_new_variants;
+ }
+
+ /// If we have new variants we need to update current variant info and extend Variant column
+ if (num_new_variants)
+ {
+ const DataTypes & current_variants = assert_cast(*variant_info.variant_type).getVariants();
+
+ /// We cannot combine Variants if total number of variants exceeds max_dynamic_types.
+ if (current_variants.size() + num_new_variants > max_dynamic_types)
+ {
+ /// Remember that we cannot combine our variant with this one, so we will not try to do it again.
+ variants_with_failed_combination.insert(other_variant_info.variant_name);
+ return nullptr;
+ }
+
+ /// We cannot combine Variants if total number of variants reaches max_dynamic_types and we don't have String variant.
+ if (current_variants.size() + num_new_variants == max_dynamic_types && !variant_info.variant_name_to_discriminator.contains("String") && !other_variant_info.variant_name_to_discriminator.contains("String"))
+ {
+ variants_with_failed_combination.insert(other_variant_info.variant_name);
+ return nullptr;
+ }
+
+ DataTypes all_variants = current_variants;
+ all_variants.insert(all_variants.end(), other_variants.begin(), other_variants.end());
+ auto new_variant_type = std::make_shared(all_variants);
+ updateVariantInfoAndExpandVariantColumn(new_variant_type);
+ }
+
+ /// Create a global discriminators mapping for other variant.
+ std::vector other_to_new_discriminators;
+ other_to_new_discriminators.reserve(other_variants.size());
+ for (size_t i = 0; i != other_variants.size(); ++i)
+ other_to_new_discriminators.push_back(variant_info.variant_name_to_discriminator[other_variant_info.variant_names[i]]);
+
+ /// Save mapping to cache to not calculate it again for the same Variants.
+ auto [it, _] = variant_mappings_cache.emplace(other_variant_info.variant_name, std::move(other_to_new_discriminators));
+ return &it->second;
+}
+
+void ColumnDynamic::insert(const DB::Field & x)
+{
+ /// Check if we can insert field without Variant extension.
+ if (variant_column->tryInsert(x))
+ return;
+
+ /// If we cannot insert field into current variant column, extend it with new variant for this field from its type.
+ if (addNewVariant(applyVisitor(FieldToDataType(), x)))
+ {
+ /// Now we should be able to insert this field into extended variant column.
+ variant_column->insert(x);
+ }
+ else
+ {
+ /// We reached maximum number of variants and couldn't add new variant.
+ /// This case should be really rare in real use cases.
+ /// We should always be able to add String variant and cast inserted value to String.
+ addStringVariant();
+ variant_column->insert(toString(x));
+ }
+}
+
+bool ColumnDynamic::tryInsert(const DB::Field & x)
+{
+ /// We can insert any value into Dynamic column.
+ insert(x);
+ return true;
+}
+
+
+void ColumnDynamic::insertFrom(const DB::IColumn & src_, size_t n)
+{
+ const auto & dynamic_src = assert_cast(src_);
+
+ /// Check if we have the same variants in both columns.
+ if (variant_info.variant_name == dynamic_src.variant_info.variant_name)
+ {
+ variant_column->insertFrom(*dynamic_src.variant_column, n);
+ return;
+ }
+
+ auto & variant_col = assert_cast(*variant_column);
+
+ /// If variants are different, we need to extend our variant with new variants.
+ if (auto * global_discriminators_mapping = combineVariants(dynamic_src.variant_info))
+ {
+ variant_col.insertFrom(*dynamic_src.variant_column, n, *global_discriminators_mapping);
+ return;
+ }
+
+ /// We cannot combine 2 Variant types as total number of variants exceeds the limit.
+ /// We need to insert single value, try to add only corresponding variant.
+ const auto & src_variant_col = assert_cast(*dynamic_src.variant_column);
+ auto src_global_discr = src_variant_col.globalDiscriminatorAt(n);
+
+ /// NULL doesn't require Variant extension.
+ if (src_global_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ {
+ insertDefault();
+ return;
+ }
+
+ auto variant_type = assert_cast(*dynamic_src.variant_info.variant_type).getVariants()[src_global_discr];
+ if (addNewVariant(variant_type))
+ {
+ auto discr = variant_info.variant_name_to_discriminator[dynamic_src.variant_info.variant_names[src_global_discr]];
+ variant_col.insertIntoVariantFrom(discr, src_variant_col.getVariantByGlobalDiscriminator(src_global_discr), src_variant_col.offsetAt(n));
+ return;
+ }
+
+ /// We reached maximum number of variants and couldn't add new variant.
+ /// We should always be able to add String variant and cast inserted value to String.
+ addStringVariant();
+ auto tmp_variant_column = src_variant_col.getVariantByGlobalDiscriminator(src_global_discr).cloneEmpty();
+ tmp_variant_column->insertFrom(src_variant_col.getVariantByGlobalDiscriminator(src_global_discr), src_variant_col.offsetAt(n));
+ auto tmp_string_column = castColumn(ColumnWithTypeAndName(tmp_variant_column->getPtr(), variant_type, ""), std::make_shared());
+ auto string_variant_discr = variant_info.variant_name_to_discriminator["String"];
+ variant_col.insertIntoVariantFrom(string_variant_discr, *tmp_string_column, 0);
+}
+
+void ColumnDynamic::insertRangeFrom(const DB::IColumn & src_, size_t start, size_t length)
+{
+ if (start + length > src_.size())
+ throw Exception(ErrorCodes::PARAMETER_OUT_OF_BOUND, "Parameter out of bound in ColumnDynamic::insertRangeFrom method. "
+ "[start({}) + length({}) > src.size()({})]", start, length, src_.size());
+
+ const auto & dynamic_src = assert_cast(src_);
+
+ /// Check if we have the same variants in both columns.
+ if (variant_info.variant_names == dynamic_src.variant_info.variant_names)
+ {
+ variant_column->insertRangeFrom(*dynamic_src.variant_column, start, length);
+ return;
+ }
+
+ auto & variant_col = assert_cast(*variant_column);
+
+ /// If variants are different, we need to extend our variant with new variants.
+ if (auto * global_discriminators_mapping = combineVariants(dynamic_src.variant_info))
+ {
+ variant_col.insertRangeFrom(*dynamic_src.variant_column, start, length, *global_discriminators_mapping);
+ return;
+ }
+
+ /// We cannot combine 2 Variant types as total number of variants exceeds the limit.
+ /// In this case we will add most frequent variants from this range and insert them as usual,
+ /// all other variants will be converted to String.
+ /// TODO: instead of keeping all current variants and just adding new most frequent variants
+ /// from source columns we can also try to replace rarest existing variants with frequent
+ /// variants from source column (so we will avoid casting new frequent variants to String
+ /// and keeping rare existing ones). It will require rewriting of existing data in Variant
+ /// column but will improve usability of Dynamic column for example during squashing blocks
+ /// during insert.
+
+ const auto & src_variant_column = dynamic_src.getVariantColumn();
+
+ /// Calculate ranges for each variant in current range.
+ std::vector> variants_ranges(dynamic_src.variant_info.variant_names.size(), {0, 0});
+ /// If we insert the whole column, no need to iterate through the range, we can just take variant sizes.
+ if (start == 0 && length == dynamic_src.size())
+ {
+ for (size_t i = 0; i != dynamic_src.variant_info.variant_names.size(); ++i)
+ variants_ranges[i] = {0, src_variant_column.getVariantByGlobalDiscriminator(i).size()};
+ }
+ /// Otherwise we need to iterate through discriminators and calculate the range for each variant.
+ else
+ {
+ const auto & local_discriminators = src_variant_column.getLocalDiscriminators();
+ const auto & offsets = src_variant_column.getOffsets();
+ size_t end = start + length;
+ for (size_t i = start; i != end; ++i)
+ {
+ auto discr = src_variant_column.globalDiscriminatorByLocal(local_discriminators[i]);
+ if (discr != ColumnVariant::NULL_DISCRIMINATOR)
+ {
+ if (!variants_ranges[discr].second)
+ variants_ranges[discr].first = offsets[i];
+ ++variants_ranges[discr].second;
+ }
+ }
+ }
+
+ const auto & src_variants = assert_cast(*dynamic_src.variant_info.variant_type).getVariants();
+ /// List of variants that will be converted to String.
+ std::vector variants_to_convert_to_string;
+ /// Mapping from global discriminators of src_variant to the new variant we will create.
+ std::vector other_to_new_discriminators;
+ other_to_new_discriminators.reserve(dynamic_src.variant_info.variant_names.size());
+
+ /// Check if we cannot add any more new variants. In this case we will convert all new variants to String.
+ if (variant_info.variant_names.size() == max_dynamic_types || (variant_info.variant_names.size() == max_dynamic_types - 1 && !variant_info.variant_name_to_discriminator.contains("String")))
+ {
+ addStringVariant();
+ for (size_t i = 0; i != dynamic_src.variant_info.variant_names.size(); ++i)
+ {
+ auto it = variant_info.variant_name_to_discriminator.find(dynamic_src.variant_info.variant_names[i]);
+ if (it == variant_info.variant_name_to_discriminator.end())
+ {
+ variants_to_convert_to_string.push_back(i);
+ other_to_new_discriminators.push_back(variant_info.variant_name_to_discriminator["String"]);
+ }
+ else
+ {
+ other_to_new_discriminators.push_back(it->second);
+ }
+ }
+ }
+ /// We still can add some new variants, but not all of them. Let's choose the most frequent variants in specified range.
+ else
+ {
+ std::vector> new_variants_with_sizes;
+ new_variants_with_sizes.reserve(dynamic_src.variant_info.variant_names.size());
+ for (size_t i = 0; i != dynamic_src.variant_info.variant_names.size(); ++i)
+ {
+ const auto & variant_name = dynamic_src.variant_info.variant_names[i];
+ if (variant_name != "String" && !variant_info.variant_name_to_discriminator.contains(variant_name))
+ new_variants_with_sizes.emplace_back(variants_ranges[i].second, i);
+ }
+
+ std::sort(new_variants_with_sizes.begin(), new_variants_with_sizes.end(), std::greater());
+ DataTypes new_variants = assert_cast(*variant_info.variant_type).getVariants();
+ if (!variant_info.variant_name_to_discriminator.contains("String"))
+ new_variants.push_back(std::make_shared());
+
+ for (const auto & [_, discr] : new_variants_with_sizes)
+ {
+ if (new_variants.size() != max_dynamic_types)
+ new_variants.push_back(src_variants[discr]);
+ else
+ variants_to_convert_to_string.push_back(discr);
+ }
+
+ auto new_variant_type = std::make_shared(new_variants);
+ updateVariantInfoAndExpandVariantColumn(new_variant_type);
+ auto string_variant_discriminator = variant_info.variant_name_to_discriminator.at("String");
+ for (const auto & variant_name : dynamic_src.variant_info.variant_names)
+ {
+ auto it = variant_info.variant_name_to_discriminator.find(variant_name);
+ if (it == variant_info.variant_name_to_discriminator.end())
+ other_to_new_discriminators.push_back(string_variant_discriminator);
+ else
+ other_to_new_discriminators.push_back(it->second);
+ }
+ }
+
+ /// Convert to String all variants that couldn't be added.
+ std::unordered_map variants_converted_to_string;
+ variants_converted_to_string.reserve(variants_to_convert_to_string.size());
+ for (auto discr : variants_to_convert_to_string)
+ {
+ auto [variant_start, variant_length] = variants_ranges[discr];
+ const auto & variant = src_variant_column.getVariantPtrByGlobalDiscriminator(discr);
+ if (variant_start == 0 && variant_length == variant->size())
+ variants_converted_to_string[discr] = castColumn(ColumnWithTypeAndName(variant, src_variants[discr], ""), std::make_shared());
+ else
+ variants_converted_to_string[discr] = castColumn(ColumnWithTypeAndName(variant->cut(variant_start, variant_length), src_variants[discr], ""), std::make_shared());
+ }
+
+ const auto & src_local_discriminators = src_variant_column.getLocalDiscriminators();
+ const auto & src_offsets = src_variant_column.getOffsets();
+ const auto & src_variant_columns = src_variant_column.getVariants();
+ size_t end = start + length;
+ for (size_t i = start; i != end; ++i)
+ {
+ auto local_discr = src_local_discriminators[i];
+ if (local_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ {
+ variant_col.insertDefault();
+ }
+ else
+ {
+ auto global_discr = src_variant_column.globalDiscriminatorByLocal(local_discr);
+ auto to_global_discr = other_to_new_discriminators[global_discr];
+ auto it = variants_converted_to_string.find(global_discr);
+ if (it == variants_converted_to_string.end())
+ {
+ variant_col.insertIntoVariantFrom(to_global_discr, *src_variant_columns[local_discr], src_offsets[i]);
+ }
+ else
+ {
+ variant_col.insertIntoVariantFrom(to_global_discr, *it->second, src_offsets[i] - variants_ranges[global_discr].first);
+ }
+ }
+ }
+}
+
+void ColumnDynamic::insertManyFrom(const DB::IColumn & src_, size_t position, size_t length)
+{
+ const auto & dynamic_src = assert_cast(src_);
+
+ /// Check if we have the same variants in both columns.
+ if (variant_info.variant_names == dynamic_src.variant_info.variant_names)
+ {
+ variant_column->insertManyFrom(*dynamic_src.variant_column, position, length);
+ return;
+ }
+
+ auto & variant_col = assert_cast(*variant_column);
+
+ /// If variants are different, we need to extend our variant with new variants.
+ if (auto * global_discriminators_mapping = combineVariants(dynamic_src.variant_info))
+ {
+ variant_col.insertManyFrom(*dynamic_src.variant_column, position, length, *global_discriminators_mapping);
+ return;
+ }
+
+ /// We cannot combine 2 Variant types as total number of variants exceeds the limit.
+ /// We need to insert single value, try to add only corresponding variant.
+ const auto & src_variant_col = assert_cast(*dynamic_src.variant_column);
+ auto src_global_discr = src_variant_col.globalDiscriminatorAt(position);
+ if (src_global_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ {
+ insertDefault();
+ return;
+ }
+
+ auto variant_type = assert_cast(*dynamic_src.variant_info.variant_type).getVariants()[src_global_discr];
+ if (addNewVariant(variant_type))
+ {
+ auto discr = variant_info.variant_name_to_discriminator[dynamic_src.variant_info.variant_names[src_global_discr]];
+ variant_col.insertManyIntoVariantFrom(discr, src_variant_col.getVariantByGlobalDiscriminator(src_global_discr), src_variant_col.offsetAt(position), length);
+ return;
+ }
+
+ addStringVariant();
+ auto tmp_variant_column = src_variant_col.getVariantByGlobalDiscriminator(src_global_discr).cloneEmpty();
+ tmp_variant_column->insertFrom(src_variant_col.getVariantByGlobalDiscriminator(src_global_discr), src_variant_col.offsetAt(position));
+ auto tmp_string_column = castColumn(ColumnWithTypeAndName(tmp_variant_column->getPtr(), variant_type, ""), std::make_shared());
+ auto string_variant_discr = variant_info.variant_name_to_discriminator["String"];
+ variant_col.insertManyIntoVariantFrom(string_variant_discr, *tmp_string_column, 0, length);
+}
+
+
+StringRef ColumnDynamic::serializeValueIntoArena(size_t n, DB::Arena & arena, const char *& begin) const
+{
+ /// We cannot use Variant serialization here as it serializes discriminator + value,
+ /// but Dynamic doesn't have fixed mapping discriminator <-> variant type
+ /// as different Dynamic column can have different Variants.
+ /// Instead, we serialize null bit + variant type name (size + bytes) + value.
+ const auto & variant_col = assert_cast(*variant_column);
+ auto discr = variant_col.globalDiscriminatorAt(n);
+ StringRef res;
+ UInt8 null_bit = discr == ColumnVariant::NULL_DISCRIMINATOR;
+ if (null_bit)
+ {
+ char * pos = arena.allocContinue(sizeof(UInt8), begin);
+ memcpy(pos, &null_bit, sizeof(UInt8));
+ res.data = pos;
+ res.size = sizeof(UInt8);
+ return res;
+ }
+
+ const auto & variant_name = variant_info.variant_names[discr];
+ size_t variant_name_size = variant_name.size();
+ char * pos = arena.allocContinue(sizeof(UInt8) + sizeof(size_t) + variant_name.size(), begin);
+ memcpy(pos, &null_bit, sizeof(UInt8));
+ memcpy(pos + sizeof(UInt8), &variant_name_size, sizeof(size_t));
+ memcpy(pos + sizeof(UInt8) + sizeof(size_t), variant_name.data(), variant_name.size());
+ res.data = pos;
+ res.size = sizeof(UInt8) + sizeof(size_t) + variant_name.size();
+
+ auto value_ref = variant_col.getVariantByGlobalDiscriminator(discr).serializeValueIntoArena(variant_col.offsetAt(n), arena, begin);
+ res.data = value_ref.data - res.size;
+ res.size += value_ref.size;
+ return res;
+}
+
+const char * ColumnDynamic::deserializeAndInsertFromArena(const char * pos)
+{
+ auto & variant_col = assert_cast(*variant_column);
+ UInt8 null_bit = unalignedLoad(pos);
+ pos += sizeof(UInt8);
+ if (null_bit)
+ {
+ insertDefault();
+ return pos;
+ }
+
+ /// Read variant type name.
+ const size_t variant_name_size = unalignedLoad(pos);
+ pos += sizeof(variant_name_size);
+ String variant_name;
+ variant_name.resize(variant_name_size);
+ memcpy(variant_name.data(), pos, variant_name_size);
+ pos += variant_name_size;
+ /// If we already have such variant, just deserialize it into corresponding variant column.
+ auto it = variant_info.variant_name_to_discriminator.find(variant_name);
+ if (it != variant_info.variant_name_to_discriminator.end())
+ {
+ auto discr = it->second;
+ return variant_col.deserializeVariantAndInsertFromArena(discr, pos);
+ }
+
+ /// If we don't have such variant, add it.
+ auto variant_type = DataTypeFactory::instance().get(variant_name);
+ if (likely(addNewVariant(variant_type)))
+ {
+ auto discr = variant_info.variant_name_to_discriminator[variant_name];
+ return variant_col.deserializeVariantAndInsertFromArena(discr, pos);
+ }
+
+ /// We reached maximum number of variants and couldn't add new variant.
+ /// We should always be able to add String variant and cast inserted value to String.
+ addStringVariant();
+ /// Create temporary column of this variant type and deserialize value into it.
+ auto tmp_variant_column = variant_type->createColumn();
+ pos = tmp_variant_column->deserializeAndInsertFromArena(pos);
+ /// Cast temporary column to String and insert this value into String variant.
+ auto str_column = castColumn(ColumnWithTypeAndName(tmp_variant_column->getPtr(), variant_type, ""), std::make_shared());
+ variant_col.insertIntoVariantFrom(variant_info.variant_name_to_discriminator["String"], *str_column, 0);
+ return pos;
+}
+
+const char * ColumnDynamic::skipSerializedInArena(const char * pos) const
+{
+ UInt8 null_bit = unalignedLoad(pos);
+ pos += sizeof(UInt8);
+ if (null_bit)
+ return pos;
+
+ const size_t variant_name_size = unalignedLoad(pos);
+ pos += sizeof(variant_name_size);
+ String variant_name;
+ variant_name.resize(variant_name_size);
+ memcpy(variant_name.data(), pos, variant_name_size);
+ pos += variant_name_size;
+ auto tmp_variant_column = DataTypeFactory::instance().get(variant_name)->createColumn();
+ return tmp_variant_column->skipSerializedInArena(pos);
+}
+
+void ColumnDynamic::updateHashWithValue(size_t n, SipHash & hash) const
+{
+ const auto & variant_col = assert_cast(*variant_column);
+ auto discr = variant_col.globalDiscriminatorAt(n);
+ if (discr == ColumnVariant::NULL_DISCRIMINATOR)
+ {
+ hash.update(discr);
+ return;
+ }
+
+ hash.update(variant_info.variant_names[discr]);
+ variant_col.getVariantByGlobalDiscriminator(discr).updateHashWithValue(variant_col.offsetAt(n), hash);
+}
+
+int ColumnDynamic::compareAt(size_t n, size_t m, const DB::IColumn & rhs, int nan_direction_hint) const
+{
+ const auto & left_variant = assert_cast(*variant_column);
+ const auto & right_dynamic = assert_cast(rhs);
+ const auto & right_variant = assert_cast(*right_dynamic.variant_column);
+
+ auto left_discr = left_variant.globalDiscriminatorAt(n);
+ auto right_discr = right_variant.globalDiscriminatorAt(m);
+
+ /// Check if we have NULLs and return result based on nan_direction_hint.
+ if (left_discr == ColumnVariant::NULL_DISCRIMINATOR && right_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ return 0;
+ else if (left_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ return nan_direction_hint;
+ else if (right_discr == ColumnVariant::NULL_DISCRIMINATOR)
+ return -nan_direction_hint;
+
+ /// If rows have different types, we compare type names.
+ if (variant_info.variant_names[left_discr] != right_dynamic.variant_info.variant_names[right_discr])
+ return variant_info.variant_names[left_discr] < right_dynamic.variant_info.variant_names[right_discr] ? -1 : 1;
+
+ /// If rows have the same types, compare actual values from corresponding variants.
+ return left_variant.getVariantByGlobalDiscriminator(left_discr).compareAt(left_variant.offsetAt(n), right_variant.offsetAt(m), right_variant.getVariantByGlobalDiscriminator(right_discr), nan_direction_hint);
+}
+
+ColumnPtr ColumnDynamic::compress() const
+{
+ ColumnPtr variant_compressed = variant_column->compress();
+ size_t byte_size = variant_compressed->byteSize();
+ return ColumnCompressed::create(size(), byte_size,
+ [my_variant_compressed = std::move(variant_compressed), my_variant_info = variant_info, my_max_dynamic_types = max_dynamic_types, my_statistics = statistics]() mutable
+ {
+ return ColumnDynamic::create(my_variant_compressed->decompress(), my_variant_info, my_max_dynamic_types, my_statistics);
+ });
+}
+
+void ColumnDynamic::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ if (!empty())
+ throw Exception(ErrorCodes::LOGICAL_ERROR, "takeDynamicStructureFromSourceColumns should be called only on empty Dynamic column");
+
+ /// During serialization of Dynamic column in MergeTree all Dynamic columns
+ /// in single part must have the same structure (the same variants). During merge
+ /// resulting column is constructed by inserting from source columns,
+ /// but it may happen that resulting column doesn't have rows from all source parts
+ /// but only from subset of them, and as a result some variants could be missing
+ /// and structures of resulting column may differ.
+ /// To solve this problem, before merge we create empty resulting column and use this method
+ /// to take dynamic structure from all source column even if we won't insert
+ /// rows from some of them.
+
+ /// We want to construct resulting variant with most frequent variants from source columns and convert the rarest
+ /// variants to single String variant if we exceed the limit of variants.
+ /// First, collect all variants from all source columns and calculate total sizes.
+ std::unordered_map total_sizes;
+ DataTypes all_variants;
+
+ for (const auto & source_column : source_columns)
+ {
+ const auto & source_dynamic = assert_cast(*source_column);
+ const auto & source_variant_column = source_dynamic.getVariantColumn();
+ const auto & source_variant_info = source_dynamic.getVariantInfo();
+ const auto & source_variants = assert_cast(*source_variant_info.variant_type).getVariants();
+ /// During deserialization from MergeTree we will have variant sizes statistics from the whole data part.
+ const auto & source_statistics = source_dynamic.getStatistics();
+ for (size_t i = 0; i != source_variants.size(); ++i)
+ {
+ const auto & variant_name = source_variant_info.variant_names[i];
+ auto it = total_sizes.find(variant_name);
+ /// Add this variant to the list of all variants if we didn't see it yet.
+ if (it == total_sizes.end())
+ {
+ all_variants.push_back(source_variants[i]);
+ it = total_sizes.emplace(variant_name, 0).first;
+ }
+ auto statistics_it = source_statistics.data.find(variant_name);
+ size_t size = statistics_it == source_statistics.data.end() ? source_variant_column.getVariantByGlobalDiscriminator(i).size() : statistics_it->second;
+ it->second += size;
+ }
+ }
+
+ DataTypePtr result_variant_type;
+ /// Check if the number of all variants exceeds the limit.
+ if (all_variants.size() > max_dynamic_types || (all_variants.size() == max_dynamic_types && !total_sizes.contains("String")))
+ {
+ /// Create list of variants with their sizes and sort it.
+ std::vector> variants_with_sizes;
+ variants_with_sizes.reserve(all_variants.size());
+ for (const auto & variant : all_variants)
+ variants_with_sizes.emplace_back(total_sizes[variant->getName()], variant);
+ std::sort(variants_with_sizes.begin(), variants_with_sizes.end(), std::greater());
+
+ /// Take first max_dynamic_types variants from sorted list.
+ DataTypes result_variants;
+ result_variants.reserve(max_dynamic_types);
+ /// Add String variant in advance.
+ result_variants.push_back(std::make_shared());
+ for (const auto & [_, variant] : variants_with_sizes)
+ {
+ if (result_variants.size() == max_dynamic_types)
+ break;
+
+ if (variant->getName() != "String")
+ result_variants.push_back(variant);
+ }
+
+ result_variant_type = std::make_shared(result_variants);
+ }
+ else
+ {
+ result_variant_type = std::make_shared(all_variants);
+ }
+
+ /// Now we have resulting Variant and can fill variant info.
+ variant_info.variant_type = result_variant_type;
+ variant_info.variant_name = result_variant_type->getName();
+ const auto & result_variants = assert_cast(*result_variant_type).getVariants();
+ variant_info.variant_names.clear();
+ variant_info.variant_names.reserve(result_variants.size());
+ variant_info.variant_name_to_discriminator.clear();
+ variant_info.variant_name_to_discriminator.reserve(result_variants.size());
+ statistics.data.clear();
+ statistics.data.reserve(result_variants.size());
+ statistics.source = Statistics::Source::MERGE;
+ for (size_t i = 0; i != result_variants.size(); ++i)
+ {
+ auto variant_name = result_variants[i]->getName();
+ variant_info.variant_names.push_back(variant_name);
+ variant_info.variant_name_to_discriminator[variant_name] = i;
+ statistics.data[variant_name] = total_sizes[variant_name];
+ }
+
+ variant_column = variant_info.variant_type->createColumn();
+
+ /// Now we have the resulting Variant that will be used in all merged columns.
+ /// Variants can also contain Dynamic columns inside, we should collect
+ /// all source variants that will be used in the resulting merged column
+ /// and call takeDynamicStructureFromSourceColumns on all resulting variants.
+ std::vector variants_source_columns;
+ variants_source_columns.resize(variant_info.variant_names.size());
+ for (const auto & source_column : source_columns)
+ {
+ const auto & source_dynamic_column = assert_cast(*source_column);
+ const auto & source_variant_info = source_dynamic_column.getVariantInfo();
+ for (size_t i = 0; i != variant_info.variant_names.size(); ++i)
+ {
+ /// Try to find this variant in current source column.
+ auto it = source_variant_info.variant_name_to_discriminator.find(variant_info.variant_names[i]);
+ if (it != source_variant_info.variant_name_to_discriminator.end())
+ variants_source_columns[i].push_back(source_dynamic_column.getVariantColumn().getVariantPtrByGlobalDiscriminator(it->second));
+ }
+ }
+
+ auto & variant_col = getVariantColumn();
+ for (size_t i = 0; i != variant_info.variant_names.size(); ++i)
+ variant_col.getVariantByGlobalDiscriminator(i).takeDynamicStructureFromSourceColumns(variants_source_columns[i]);
+}
+
+void ColumnDynamic::applyNullMap(const ColumnVector::Container & null_map)
+{
+ assert_cast(*variant_column).applyNullMap(null_map);
+}
+
+void ColumnDynamic::applyNegatedNullMap(const ColumnVector::Container & null_map)
+{
+ assert_cast(*variant_column).applyNegatedNullMap(null_map);
+}
+
+}
diff --git a/src/Columns/ColumnDynamic.h b/src/Columns/ColumnDynamic.h
new file mode 100644
index 00000000000..27ad0dd583f
--- /dev/null
+++ b/src/Columns/ColumnDynamic.h
@@ -0,0 +1,365 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+
+
+namespace DB
+{
+
+/**
+ * Column for storing Dynamic type values.
+ * Dynamic column allows to insert and store values of any data types inside.
+ * Inside it stores:
+ * - Variant column with all inserted values of different types.
+ * - Information about currently stored variants.
+ *
+ * When new values are inserted into Dynamic column, the internal Variant
+ * type and column are extended if the inserted value has new type.
+ */
+class ColumnDynamic final : public COWHelper, ColumnDynamic>
+{
+public:
+ ///
+ struct Statistics
+ {
+ enum class Source
+ {
+ READ, /// Statistics were loaded into column during reading from MergeTree.
+ MERGE, /// Statistics were calculated during merge of several MergeTree parts.
+ };
+
+ /// Source of the statistics.
+ Source source;
+ /// Statistics data: (variant name) -> (total variant size in data part).
+ std::unordered_map data;
+ };
+
+private:
+ friend class COWHelper, ColumnDynamic>;
+
+ struct VariantInfo
+ {
+ DataTypePtr variant_type;
+ /// Name of the whole variant to not call getName() every time.
+ String variant_name;
+ /// Names of variants to not call getName() every time on variants.
+ Names variant_names;
+ /// Mapping (variant name) -> (global discriminator).
+ /// It's used during variant extension.
+ std::unordered_map variant_name_to_discriminator;
+ };
+
+ explicit ColumnDynamic(size_t max_dynamic_types_);
+ ColumnDynamic(MutableColumnPtr variant_column_, const VariantInfo & variant_info_, size_t max_dynamic_types_, const Statistics & statistics_ = {});
+
+public:
+ /** Create immutable column using immutable arguments. This arguments may be shared with other columns.
+ * Use IColumn::mutate in order to make mutable column and mutate shared nested columns.
+ */
+ using Base = COWHelper, ColumnDynamic>;
+ static Ptr create(const ColumnPtr & variant_column_, const VariantInfo & variant_info_, size_t max_dynamic_types_, const Statistics & statistics_ = {})
+ {
+ return ColumnDynamic::create(variant_column_->assumeMutable(), variant_info_, max_dynamic_types_, statistics_);
+ }
+
+ static MutablePtr create(MutableColumnPtr variant_column_, const VariantInfo & variant_info_, size_t max_dynamic_types_, const Statistics & statistics_ = {})
+ {
+ return Base::create(std::move(variant_column_), variant_info_, max_dynamic_types_, statistics_);
+ }
+
+ static MutablePtr create(MutableColumnPtr variant_column_, const DataTypePtr & variant_type, size_t max_dynamic_types_, const Statistics & statistics_ = {});
+
+ static ColumnPtr create(ColumnPtr variant_column_, const DataTypePtr & variant_type, size_t max_dynamic_types_, const Statistics & statistics_ = {})
+ {
+ return create(variant_column_->assumeMutable(), variant_type, max_dynamic_types_, statistics_);
+ }
+
+ static MutablePtr create(size_t max_dynamic_types_)
+ {
+ return Base::create(max_dynamic_types_);
+ }
+
+ std::string getName() const override { return "Dynamic(max_types=" + std::to_string(max_dynamic_types) + ")"; }
+
+ const char * getFamilyName() const override
+ {
+ return "Dynamic";
+ }
+
+ TypeIndex getDataType() const override
+ {
+ return TypeIndex::Dynamic;
+ }
+
+ MutableColumnPtr cloneEmpty() const override
+ {
+ /// Keep current dynamic structure
+ return Base::create(variant_column->cloneEmpty(), variant_info, max_dynamic_types, statistics);
+ }
+
+ MutableColumnPtr cloneResized(size_t size) const override
+ {
+ return Base::create(variant_column->cloneResized(size), variant_info, max_dynamic_types, statistics);
+ }
+
+ size_t size() const override
+ {
+ return variant_column->size();
+ }
+
+ Field operator[](size_t n) const override
+ {
+ return (*variant_column)[n];
+ }
+
+ void get(size_t n, Field & res) const override
+ {
+ variant_column->get(n, res);
+ }
+
+ bool isDefaultAt(size_t n) const override
+ {
+ return variant_column->isDefaultAt(n);
+ }
+
+ bool isNullAt(size_t n) const override
+ {
+ return variant_column->isNullAt(n);
+ }
+
+ StringRef getDataAt(size_t n) const override
+ {
+ return variant_column->getDataAt(n);
+ }
+
+ void insertData(const char * pos, size_t length) override
+ {
+ variant_column->insertData(pos, length);
+ }
+
+ void insert(const Field & x) override;
+ bool tryInsert(const Field & x) override;
+ void insertFrom(const IColumn & src_, size_t n) override;
+ void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
+ void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
+
+ void insertDefault() override
+ {
+ variant_column->insertDefault();
+ }
+
+ void insertManyDefaults(size_t length) override
+ {
+ variant_column->insertManyDefaults(length);
+ }
+
+ void popBack(size_t n) override
+ {
+ variant_column->popBack(n);
+ }
+
+ StringRef serializeValueIntoArena(size_t n, Arena & arena, char const *& begin) const override;
+ const char * deserializeAndInsertFromArena(const char * pos) override;
+ const char * skipSerializedInArena(const char * pos) const override;
+
+ void updateHashWithValue(size_t n, SipHash & hash) const override;
+
+ void updateWeakHash32(WeakHash32 & hash) const override
+ {
+ variant_column->updateWeakHash32(hash);
+ }
+
+ void updateHashFast(SipHash & hash) const override
+ {
+ variant_column->updateHashFast(hash);
+ }
+
+ ColumnPtr filter(const Filter & filt, ssize_t result_size_hint) const override
+ {
+ return create(variant_column->filter(filt, result_size_hint), variant_info, max_dynamic_types);
+ }
+
+ void expand(const Filter & mask, bool inverted) override
+ {
+ variant_column->expand(mask, inverted);
+ }
+
+ ColumnPtr permute(const Permutation & perm, size_t limit) const override
+ {
+ return create(variant_column->permute(perm, limit), variant_info, max_dynamic_types);
+ }
+
+ ColumnPtr index(const IColumn & indexes, size_t limit) const override
+ {
+ return create(variant_column->index(indexes, limit), variant_info, max_dynamic_types);
+ }
+
+ ColumnPtr replicate(const Offsets & replicate_offsets) const override
+ {
+ return create(variant_column->replicate(replicate_offsets), variant_info, max_dynamic_types);
+ }
+
+ MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override
+ {
+ MutableColumns scattered_variant_columns = variant_column->scatter(num_columns, selector);
+ MutableColumns scattered_columns;
+ scattered_columns.reserve(num_columns);
+ for (auto & scattered_variant_column : scattered_variant_columns)
+ scattered_columns.emplace_back(create(std::move(scattered_variant_column), variant_info, max_dynamic_types));
+
+ return scattered_columns;
+ }
+
+ int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
+
+ bool hasEqualValues() const override
+ {
+ return variant_column->hasEqualValues();
+ }
+
+ void getExtremes(Field & min, Field & max) const override
+ {
+ variant_column->getExtremes(min, max);
+ }
+
+ void getPermutation(IColumn::PermutationSortDirection direction, IColumn::PermutationSortStability stability,
+ size_t limit, int nan_direction_hint, IColumn::Permutation & res) const override
+ {
+ variant_column->getPermutation(direction, stability, limit, nan_direction_hint, res);
+ }
+
+ void updatePermutation(IColumn::PermutationSortDirection direction, IColumn::PermutationSortStability stability,
+ size_t limit, int nan_direction_hint, IColumn::Permutation & res, EqualRanges & equal_ranges) const override
+ {
+ variant_column->updatePermutation(direction, stability, limit, nan_direction_hint, res, equal_ranges);
+ }
+
+ void reserve(size_t n) override
+ {
+ variant_column->reserve(n);
+ }
+
+ void ensureOwnership() override
+ {
+ variant_column->ensureOwnership();
+ }
+
+ size_t byteSize() const override
+ {
+ return variant_column->byteSize();
+ }
+
+ size_t byteSizeAt(size_t n) const override
+ {
+ return variant_column->byteSizeAt(n);
+ }
+
+ size_t allocatedBytes() const override
+ {
+ return variant_column->allocatedBytes();
+ }
+
+ void protect() override
+ {
+ variant_column->protect();
+ }
+
+ void forEachSubcolumn(MutableColumnCallback callback) override
+ {
+ callback(variant_column);
+ }
+
+ void forEachSubcolumnRecursively(RecursiveMutableColumnCallback callback) override
+ {
+ callback(*variant_column);
+ variant_column->forEachSubcolumnRecursively(callback);
+ }
+
+ bool structureEquals(const IColumn & rhs) const override
+ {
+ if (const auto * rhs_concrete = typeid_cast(&rhs))
+ return max_dynamic_types == rhs_concrete->max_dynamic_types;
+ return false;
+ }
+
+ ColumnPtr compress() const override;
+
+ double getRatioOfDefaultRows(double sample_ratio) const override
+ {
+ return variant_column->getRatioOfDefaultRows(sample_ratio);
+ }
+
+ UInt64 getNumberOfDefaultRows() const override
+ {
+ return variant_column->getNumberOfDefaultRows();
+ }
+
+ void getIndicesOfNonDefaultRows(Offsets & indices, size_t from, size_t limit) const override
+ {
+ variant_column->getIndicesOfNonDefaultRows(indices, from, limit);
+ }
+
+ void finalize() override
+ {
+ variant_column->finalize();
+ }
+
+ bool isFinalized() const override
+ {
+ return variant_column->isFinalized();
+ }
+
+ /// Apply null map to a nested Variant column.
+ void applyNullMap(const ColumnVector::Container & null_map);
+ void applyNegatedNullMap(const ColumnVector::Container & null_map);
+
+ const VariantInfo & getVariantInfo() const { return variant_info; }
+
+ const ColumnPtr & getVariantColumnPtr() const { return variant_column; }
+ ColumnPtr & getVariantColumnPtr() { return variant_column; }
+
+ const ColumnVariant & getVariantColumn() const { return assert_cast(*variant_column); }
+ ColumnVariant & getVariantColumn() { return assert_cast(*variant_column); }
+
+ bool addNewVariant(const DataTypePtr & new_variant);
+ void addStringVariant();
+
+ bool hasDynamicStructure() const override { return true; }
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
+
+ const Statistics & getStatistics() const { return statistics; }
+
+ size_t getMaxDynamicTypes() const { return max_dynamic_types; }
+
+private:
+ /// Combine current variant with the other variant and return global discriminators mapping
+ /// from other variant to the combined one. It's used for inserting from
+ /// different variants.
+ /// Returns nullptr if maximum number of variants is reached and the new variant cannot be created.
+ std::vector * combineVariants(const VariantInfo & other_variant_info);
+
+ void updateVariantInfoAndExpandVariantColumn(const DataTypePtr & new_variant_type);
+
+ WrappedPtr variant_column;
+ /// Store the type of current variant with some additional information.
+ VariantInfo variant_info;
+ /// The maximum number of different types that can be stored in this Dynamic column.
+ /// If exceeded, all new variants will be converted to String.
+ size_t max_dynamic_types;
+
+ /// Size statistics of each variants from MergeTree data part.
+ /// Used in takeDynamicStructureFromSourceColumns and set during deserialization.
+ Statistics statistics;
+
+ /// Cache (Variant name) -> (global discriminators mapping from this variant to current variant in Dynamic column).
+ /// Used to avoid mappings recalculation in combineVariants for the same Variant types.
+ std::unordered_map> variant_mappings_cache;
+ /// Cache of Variant types that couldn't be combined with current variant in Dynamic column.
+ /// Used to avoid checking if combination is possible for the same Variant types.
+ std::unordered_set variants_with_failed_combination;
+};
+
+}
diff --git a/src/Columns/ColumnMap.cpp b/src/Columns/ColumnMap.cpp
index 57e8ba685b4..eecea1a273f 100644
--- a/src/Columns/ColumnMap.cpp
+++ b/src/Columns/ColumnMap.cpp
@@ -312,4 +312,13 @@ ColumnPtr ColumnMap::compress() const
});
}
+void ColumnMap::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ Columns nested_source_columns;
+ nested_source_columns.reserve(source_columns.size());
+ for (const auto & source_column : source_columns)
+ nested_source_columns.push_back(assert_cast(*source_column).getNestedColumnPtr());
+ nested->takeDynamicStructureFromSourceColumns(nested_source_columns);
+}
+
}
diff --git a/src/Columns/ColumnMap.h b/src/Columns/ColumnMap.h
index 60aa69e7bf6..52165d0d74e 100644
--- a/src/Columns/ColumnMap.h
+++ b/src/Columns/ColumnMap.h
@@ -104,6 +104,9 @@ public:
ColumnTuple & getNestedData() { return assert_cast(getNestedColumn().getData()); }
ColumnPtr compress() const override;
+
+ bool hasDynamicStructure() const override { return nested->hasDynamicStructure(); }
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
};
}
diff --git a/src/Columns/ColumnNullable.cpp b/src/Columns/ColumnNullable.cpp
index 30e62548ad6..dd9387d96b1 100644
--- a/src/Columns/ColumnNullable.cpp
+++ b/src/Columns/ColumnNullable.cpp
@@ -868,6 +868,15 @@ ColumnPtr ColumnNullable::getNestedColumnWithDefaultOnNull() const
return res;
}
+void ColumnNullable::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ Columns nested_source_columns;
+ nested_source_columns.reserve(source_columns.size());
+ for (const auto & source_column : source_columns)
+ nested_source_columns.push_back(assert_cast(*source_column).getNestedColumnPtr());
+ nested_column->takeDynamicStructureFromSourceColumns(nested_source_columns);
+}
+
ColumnPtr makeNullable(const ColumnPtr & column)
{
if (isColumnNullable(*column))
@@ -924,4 +933,23 @@ ColumnPtr makeNullableOrLowCardinalityNullableSafe(const ColumnPtr & column)
return column;
}
+ColumnPtr removeNullable(const ColumnPtr & column)
+{
+ if (const auto * column_nullable = typeid_cast(column.get()))
+ return column_nullable->getNestedColumnPtr();
+ return column;
+}
+
+ColumnPtr removeNullableOrLowCardinalityNullable(const ColumnPtr & column)
+{
+ if (const auto * column_low_cardinality = typeid_cast(column.get()))
+ {
+ if (!column_low_cardinality->nestedIsNullable())
+ return column;
+ return column_low_cardinality->cloneWithDefaultOnNull();
+ }
+
+ return removeNullable(column);
+}
+
}
diff --git a/src/Columns/ColumnNullable.h b/src/Columns/ColumnNullable.h
index c7ebb6ed7b6..266c188db25 100644
--- a/src/Columns/ColumnNullable.h
+++ b/src/Columns/ColumnNullable.h
@@ -190,6 +190,9 @@ public:
/// Check that size of null map equals to size of nested column.
void checkConsistency() const;
+ bool hasDynamicStructure() const override { return nested_column->hasDynamicStructure(); }
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
+
private:
WrappedPtr nested_column;
WrappedPtr null_map;
@@ -211,4 +214,7 @@ ColumnPtr makeNullableSafe(const ColumnPtr & column);
ColumnPtr makeNullableOrLowCardinalityNullable(const ColumnPtr & column);
ColumnPtr makeNullableOrLowCardinalityNullableSafe(const ColumnPtr & column);
+ColumnPtr removeNullable(const ColumnPtr & column);
+ColumnPtr removeNullableOrLowCardinalityNullable(const ColumnPtr & column);
+
}
diff --git a/src/Columns/ColumnSparse.cpp b/src/Columns/ColumnSparse.cpp
index 3a63d2bffc5..2e75a2fd4ab 100644
--- a/src/Columns/ColumnSparse.cpp
+++ b/src/Columns/ColumnSparse.cpp
@@ -8,7 +8,6 @@
#include
#include
#include
-#include
#include
#include
@@ -801,6 +800,15 @@ ColumnSparse::Iterator ColumnSparse::getIterator(size_t n) const
return Iterator(offsets_data, _size, current_offset, n);
}
+void ColumnSparse::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ Columns values_source_columns;
+ values_source_columns.reserve(source_columns.size());
+ for (const auto & source_column : source_columns)
+ values_source_columns.push_back(assert_cast(*source_column).getValuesPtr());
+ values->takeDynamicStructureFromSourceColumns(values_source_columns);
+}
+
ColumnPtr recursiveRemoveSparse(const ColumnPtr & column)
{
if (!column)
diff --git a/src/Columns/ColumnSparse.h b/src/Columns/ColumnSparse.h
index c1bd614102c..7d3200da35f 100644
--- a/src/Columns/ColumnSparse.h
+++ b/src/Columns/ColumnSparse.h
@@ -148,6 +148,9 @@ public:
size_t sizeOfValueIfFixed() const override { return values->sizeOfValueIfFixed() + values->sizeOfValueIfFixed(); }
bool isCollationSupported() const override { return values->isCollationSupported(); }
+ bool hasDynamicStructure() const override { return values->hasDynamicStructure(); }
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
+
size_t getNumberOfTrailingDefaults() const
{
return offsets->empty() ? _size : _size - getOffsetsData().back() - 1;
diff --git a/src/Columns/ColumnTuple.cpp b/src/Columns/ColumnTuple.cpp
index 2393fcf92fd..31734edced4 100644
--- a/src/Columns/ColumnTuple.cpp
+++ b/src/Columns/ColumnTuple.cpp
@@ -572,6 +572,34 @@ bool ColumnTuple::isCollationSupported() const
return false;
}
+bool ColumnTuple::hasDynamicStructure() const
+{
+ for (const auto & column : columns)
+ {
+ if (column->hasDynamicStructure())
+ return true;
+ }
+ return false;
+}
+
+void ColumnTuple::takeDynamicStructureFromSourceColumns(const Columns & source_columns)
+{
+ std::vector nested_source_columns;
+ nested_source_columns.resize(columns.size());
+ for (size_t i = 0; i != columns.size(); ++i)
+ nested_source_columns[i].reserve(source_columns.size());
+
+ for (const auto & source_column : source_columns)
+ {
+ const auto & nsource_columns = assert_cast(*source_column).getColumns();
+ for (size_t i = 0; i != nsource_columns.size(); ++i)
+ nested_source_columns[i].push_back(nsource_columns[i]);
+ }
+
+ for (size_t i = 0; i != columns.size(); ++i)
+ columns[i]->takeDynamicStructureFromSourceColumns(nested_source_columns[i]);
+}
+
ColumnPtr ColumnTuple::compress() const
{
diff --git a/src/Columns/ColumnTuple.h b/src/Columns/ColumnTuple.h
index 5b626155754..65103fa8c49 100644
--- a/src/Columns/ColumnTuple.h
+++ b/src/Columns/ColumnTuple.h
@@ -114,6 +114,9 @@ public:
const ColumnPtr & getColumnPtr(size_t idx) const { return columns[idx]; }
ColumnPtr & getColumnPtr(size_t idx) { return columns[idx]; }
+ bool hasDynamicStructure() const override;
+ void takeDynamicStructureFromSourceColumns(const Columns & source_columns) override;
+
private:
int compareAtImpl(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint, const Collator * collator=nullptr) const;
diff --git a/src/Columns/ColumnVariant.cpp b/src/Columns/ColumnVariant.cpp
index 31e9b0964f4..ec47f5dfa74 100644
--- a/src/Columns/ColumnVariant.cpp
+++ b/src/Columns/ColumnVariant.cpp
@@ -12,7 +12,6 @@
#include
#include
#include
-#include